• Save
F#3.0
Upcoming SlideShare
Loading in...5
×
 

F#3.0

on

  • 584 views

Apresentação de F# 3.0

Apresentação de F# 3.0

Statistics

Views

Total Views
584
Views on SlideShare
584
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • have linq, have create way to manipulate data, but how do you get the schema?
  • who here has used one of these apis?
  • show how cloud numerics solves a problem“how would you do numerical analysis on large quantities of data?”(be interactive)- connect to problems they are already working on- “show how sausage is made” : what were we thinking in design?- type providers are linq on steroids

F#3.0 F#3.0 Presentation Transcript

  • F# Information RichProgrammingRodrigo VidalVisual F# MVP
  • What’s in this talk?• Intro to F#• Language features for solving real-world problems• F# Type Provider demos• Future directions
  • F# Tagline F# is a practical, functional-first language that lets you write simple code to solve complex problems
  • Created By
  • Motivation Ideas Product Research Reality
  • #inceptionLambda LISP ML Ocaml HaskellCalculus F#
  • F# 1.0 Functional + Objects + .NET F# 2.0 Functional + Objects + .NET +Async + Parallel + Interactive + Scripting
  • 12 C#, VB, 10 Java LINQ F# Nirvana 8Usefulness 6 C# Nirvana 4 Haskell LINQ 2 Haskell 0 0 2 4 6 8 10 12 Safety http://channel9.msdn.com/posts/Charles/Simon-Peyton-Jones-Towards-a-Programming-Language-Nirvana/
  • Immutability “Values are immutable by default”
  • Side Effects • Example: “The Butterfly Effect”• A side effect • Modifies some state • Has observable interaction with calling functions • Has observable interaction with the outside world • Example: a function or method with no return value
  • Composing Functions f(x)f(x) = 3x+2g(y) = 4y-1 g(f(2)) = ? g(x)
  • Simplicity
  • abstract class Command {Simplicity } public virtual void Execute(); C# abstract class RoverCommand : Command {Functions as values protected Rover Rover { get; private set; } public RoverCommand(MarsRover rover) { this.Rover = rover; } F# } class BrakeCommand : RoverCommand {type Command = Rover -> unit public BrakeCommand(Rover rover) : base(rover) { }let BrakeCommand = public override void Execute() { fun rover -> rover.Accelerate(-1.0) Rover.Accelerate(-1.0); } }let TurnLeftCommand = class TurnLeftCommand : RoverCommand { fun rover -> rover.Rotate(-5.0<degs>) public TurnLeftCommand(Rover rover) : base(rover) {} public override void Execute() { Rover.Rotate(-5.0); } }
  • SimplicityFunctional data let swap (x, y) = (y, x) Tuple<U,T> Swap<T,U>(Tuple<T,U> t)F# { C# return new Tuple<U,T>(t.Item2, t.Item1) } let rotations (x, y, z) = ReadOnlyCollection<Tuple<T,T,T>> Rotations<T> (Tuple<T,T,T> t) [ (x, y, z); { (z, x, y); new ReadOnlyCollection<int> (new Tuple<T,T,T>[] (y, z, x) ] { new Tuple<T,T,T>(t.Item1,t.Item2,t.Item3); new Tuple<T,T,T>(t.Item3,t.Item1,t.Item2); new Tuple<T,T,T>(t.Item2,t.Item3,t.Item1); }); } let reduce f (x, y, z) = int Reduce<T>(Func<T,int> f,Tuple<T,T,T> t) { f x + f y + f z return f(t.Item1) + f(t.Item2) + f (t.Item3); }
  • F# is declarative
  • F# 3.0Information Rich Programming
  • Two propositions
  • Proposition 1:We live in an information society
  • Proposition 2:Our languages are information sparse
  • A Big Problem
  • Challenges• Impedance mismatch with statically-typed languages• Need to manually integrate codegen tools with build process, source control, etc.• No elegant way to handle schema change• Loss of type information due to up-casts to Object, or even have to just parse strings
  • But…• Data sources often have rich schemas and associated data definitions• Static types should make your experience better, not worse!
  • Why this mattersProgramming the web
  • F# Type Providers:IntelliSense for data
  • Type provider IDE CompilerIntelliSense for Type-Check Compile using Generated Imported Types Type Provider Types
  • Demo summary• Can program against web-scale schematized data • code gen would never work here!• Don’t have to wait for codegen or code to compile• With typechecking! • Can detect schema change• With great Visual Studio tooling!
  • Demo 3:Web service with multiple data sources
  • What’s next for F#?• Cloud, cloud cloud!• Make F# programming on Azure even easier• Can use F# computation expressions to add new syntax in a library • for example, cloud { … } • F# async and query expressions are not built-in syntax—they use computation expressions
  • Computation in the Cloud
  • Cloud Numerics• Extensive library of numerical algorithms • Ranges from basic math to advanced statistics to linear algebra• Supports distributed arrays and computation• Can deploy to Azure when lots of compute resources are needed