Download - Fsharp shdh 40 lightning talk
![Page 2: Fsharp shdh 40 lightning talk](https://reader033.vdocument.in/reader033/viewer/2022042813/5495bfdeac7959482e8b4e61/html5/thumbnails/2.jpg)
Robin MilnerUniversity of EdinburghML – 1970s
Xavier Leroy, et al.INRIA, FranceOcaml - 1996
Don SymeMSR CambridgeF# - 2002
![Page 3: Fsharp shdh 40 lightning talk](https://reader033.vdocument.in/reader033/viewer/2022042813/5495bfdeac7959482e8b4e61/html5/thumbnails/3.jpg)
![Page 4: Fsharp shdh 40 lightning talk](https://reader033.vdocument.in/reader033/viewer/2022042813/5495bfdeac7959482e8b4e61/html5/thumbnails/4.jpg)
FP• First class functions• Immutability• Recursion• Type inference• Pattern matching• Lists, sequences,
tuples, records, discriminated unions
• Option type
• Monads• Asynchronous
programming• Pipeline operator |>• Currying• Continuations• Memoization
![Page 5: Fsharp shdh 40 lightning talk](https://reader033.vdocument.in/reader033/viewer/2022042813/5495bfdeac7959482e8b4e61/html5/thumbnails/5.jpg)
OO
• Classes• Inheritance• Interfaces• Structs• Properties• Delegates• Enums• Mutability
![Page 6: Fsharp shdh 40 lightning talk](https://reader033.vdocument.in/reader033/viewer/2022042813/5495bfdeac7959482e8b4e61/html5/thumbnails/6.jpg)
Tail Call Optimization.method public static int32 g(int32 x) cil managed{ .maxstack 5 L_0000: nop L_0001: ldarg.0 L_0002: ldc.i4.0 L_0003: ble.s L_0007 L_0005: br.s L_0009 L_0007: br.s L_0019 L_0009: newobj instance void Program/g@9::.ctor() L_000e: ldarg.0 L_000f: ldc.i4.1 L_0010: sub L_0011: tail L_0013: call int32 Program::f(class [FSharp.Core]Microsoft.<snip>) L_0018: ret L_0019: ldarg.0 L_001a: ret }
![Page 7: Fsharp shdh 40 lightning talk](https://reader033.vdocument.in/reader033/viewer/2022042813/5495bfdeac7959482e8b4e61/html5/thumbnails/7.jpg)
Units of Measure
[<Measure>]type kilogram
let bowlingBall = 7.26<kilogram>
let force (mass: float<kilogram>) = mass * 9.8
![Page 8: Fsharp shdh 40 lightning talk](https://reader033.vdocument.in/reader033/viewer/2022042813/5495bfdeac7959482e8b4e61/html5/thumbnails/8.jpg)
Code from "Juliet" on StackOverflow.
Euler Problem #7let isPrime num = let upperDivisor = int32(sqrt(float num)) match num with | 0 | 1 -> false | 2 -> true | n -> seq { 2 .. upperDivisor } |>
Seq.forall (fun x -> num % x <> 0) let primes = Seq.initInfinite id |> Seq.filter isPrime let nthPrime n = Seq.nth n primes printfn "The 10001st prime number is %i."
(nthPrime 10001)
![Page 9: Fsharp shdh 40 lightning talk](https://reader033.vdocument.in/reader033/viewer/2022042813/5495bfdeac7959482e8b4e61/html5/thumbnails/9.jpg)
More…
• Matt Harrington: [email protected]• SFsharp.org• Luca Bolognese’s video (see links on
SFsharp.org)• Programming F# by Chris Smith