slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Cody Coleman, Matt Davis, and Mel Green PowerPoint Presentation
Download Presentation
Cody Coleman, Matt Davis, and Mel Green

Loading in 2 Seconds...

play fullscreen
1 / 19

Cody Coleman, Matt Davis, and Mel Green - PowerPoint PPT Presentation


  • 111 Views
  • Uploaded on

F#. Cody Coleman, Matt Davis, and Mel Green. History of F#. Started in 2002 Created by Don Syme , and backed by Microsoft Research Group. Sought to combine the power of typed functional programming with the strengths of .Net. Influenced By.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

Cody Coleman, Matt Davis, and Mel Green


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide1

F#

Cody Coleman, Matt Davis, and Mel Green

history of f
History of F#
  • Started in 2002
  • Created by Don Syme, and backed by Microsoft Research Group.
  • Sought to combine the power of typed functional programming with the strengths of .Net
influenced by
Influenced By
  • It’s predecessors include, OCaml, ML, Haskell, and .Net languages.
  • It’s considered OCaml for .Net.
  • F# has encapsulated and build upon many of OCaml’s strengths
  • Haskell influenced Sequence Expressions and Workflows.
  • F# inherited hundreds of important and major implementation stack libraries like LINQ.
syntax
Syntax
  • Shares syntax with ancestors: ML, Ocaml
functions
Functions

let rec fib n =

match n with

| 1 | 2 -> 1

| _ -> fib(n-2) + fib(n-1)

  • Lambda fun x -> x + 1
  • Currying let add x y = x + y
piping
Piping

let algorithm n =

n

|> (fun x -> x + 5)

|> (fun x -> x * x)

|> (fun x -> x.ToString())

let result = algorithm 3

result: “64”

examples currying
Examples: Currying
  • Simple Curried Function the 2001 Space odyssey could have used to track it’s HAL 9000 Computer Automated System.
examples isprime
Examples: IsPrime
  • Simple yet effective
  • Takes a grand total of about 20 seconds
examples isprime optimized
Examples: IsPrime(optimized)
  • The largest factor of a number is its square root. So we only need the numbers from 2 to sqrt n.
  • Takes only .20 seconds
examples the optimusprime
Examples: The OptimusPrime
  • Who needs evens? 2 is the only even prime, so why test all the rest. Yield to the rescue.
  • This one takes a mind numbing, earth shattering .11 seconds.