Download - Introduction to FSharp
![Page 1: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/1.jpg)
www.dotnet.lv
![Page 2: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/2.jpg)
Valdis IljuconoksTechnical Fellow, Software ArchitectMicrosoft MVP
Geta AS, Viiar [email protected]://dotnet.lv/blogs/vi@tech_fellow
![Page 3: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/3.jpg)
F#
![Page 4: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/4.jpg)
what is it?
![Page 5: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/5.jpg)
x = x + 1
![Page 6: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/6.jpg)
First official functional programming language
on .Net
![Page 7: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/7.jpg)
why?
![Page 8: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/8.jpg)
do more with lesssee where C# and VB.NET are headed
learn new language every year
![Page 9: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/9.jpg)
functionalobject-oriented
imperative
![Page 10: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/10.jpg)
Theorem proving ISWIM (1966)
MLCAML
OCAMLF#
![Page 11: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/11.jpg)
‘let’ binding
![Page 12: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/12.jpg)
let a = 2
![Page 13: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/13.jpg)
let a = 2 int a = 2≠// F# // C#
![Page 14: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/14.jpg)
let a = 2 static int a(){ return 2;}
// F# // C#
![Page 15: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/15.jpg)
Immutable by default
let a = 2let a = 3
error: FS0037 Duplicate definition of value ‘a’
![Page 16: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/16.jpg)
StrongStatic
WeakDynamic
![Page 17: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/17.jpg)
functions
![Page 18: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/18.jpg)
let sqr x = x * x
> val sqr : int -> int
sqr 5
> val it: int = 25
parameter
signature
result
data type
![Page 19: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/19.jpg)
demo
sum of sqr of t
![Page 20: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/20.jpg)
high order functions
A higher-order function is a function
that takes another function as a parameter,or a function that returns another function as a value,
or a function which does both.
![Page 21: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/21.jpg)
let sqr x : float = x * xlet mply a b : float = a * b
let mplyPI a = mply a 3.14159
let cylinderVolume radius length = mplyPI length * sqr radius
![Page 22: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/22.jpg)
demo
function pipelining (|>)
![Page 23: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/23.jpg)
demo
function composition (>>)
![Page 24: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/24.jpg)
discriminated unions
![Page 25: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/25.jpg)
type NullableInt = | Value of int | Nothing of unit
match x with | Value -> ... | Nothing -> ...
![Page 26: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/26.jpg)
interoperability
![Page 27: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/27.jpg)
demo
.Net interoperability
![Page 28: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/28.jpg)
First official functional programming language
on .Net
![Page 29: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/29.jpg)
?
![Page 30: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/30.jpg)
Valdis IljuconoksTechnical Fellow, Software ArchitectMicrosoft MVP
Geta AS, Viiar [email protected]://dotnet.lv/blogs/vi@tech_fellow
![Page 31: Introduction to FSharp](https://reader036.vdocuments.mx/reader036/viewer/2022062319/557a8753d8b42abc638b49d8/html5/thumbnails/31.jpg)
www.dotnet.lv