projects:fsharp_workshop
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
projects:fsharp_workshop [2015/03/13 23:35] – mkucia | projects:fsharp_workshop [2015/04/17 23:03] – mkucia | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== F# workshop ====== | ====== F# workshop ====== | ||
+ | ===== Prerequisites ===== | ||
+ | * https:// | ||
+ | <hidden ↘ alternatives> | ||
+ | * Try F# in browser: http:// | ||
+ | * Use Visual Studio https:// | ||
+ | * Get a full distribution: | ||
+ | </ | ||
- | * f(x) = Hello_Word | + | ===== Agenda ===== |
- | * On Testing and | + | |
+ | * hello(x) | ||
+ | * Type providers (strongly typed) | ||
+ | * Matching | ||
+ | * Options | ||
- | <wrap hi>highlighted</wrap> | + | |
+ | ===== hello(x) ===== | ||
+ | <code fsharp> | ||
+ | let hello = printf "Hello World" | ||
+ | hello | ||
+ | </code> | ||
+ | |||
+ | <code fsharp> | ||
+ | let hello x = printfn "Hello %s" x | ||
+ | hello " | ||
+ | </ | ||
+ | |||
+ | <code fsharp> | ||
+ | let hello x = printfn "Hello %s" x | ||
+ | " | ||
+ | </ | ||
+ | '' | ||
+ | |||
+ | <code fsharp> | ||
+ | let square x = x * x | ||
+ | let subtract x y = x - y | ||
+ | </ | ||
+ | |||
+ | <code fsharp> | ||
+ | let ``complicated stuff`` x = | ||
+ | printfn " | ||
+ | </ | ||
+ | |||
+ | <code fsharp> | ||
+ | let ``another complicated stuff`` x = | ||
+ | x |> square |> subtract 5 |> printfn " | ||
+ | </ | ||
+ | |||
+ | <code fsharp> | ||
+ | let equation x = | ||
+ | x | ||
+ | |> (fun y -> y * y ) | ||
+ | |> (fun y z -> y - z ) 5 | ||
+ | |> printfn " | ||
+ | </ | ||
+ | |||
+ | ===== Why? ===== | ||
<WRAP group> | <WRAP group> | ||
Line 13: | Line 64: | ||
* Open Source | * Open Source | ||
* Multi platform (Mono, .NET core) | * Multi platform (Mono, .NET core) | ||
- | * Modern, rising | + | * Modern, rising |
* Lazy evaluation | * Lazy evaluation | ||
* Reusable | * Reusable | ||
- | * Reduced code | + | * Reduced code (See [[http:// |
* Strongly typed | * Strongly typed | ||
</ | </ | ||
Line 22: | Line 73: | ||
<WRAP half column box> | <WRAP half column box> | ||
Cons: | Cons: | ||
- | * Not suitable for real time | + | * Not suitable for real time (unpredictable performance) |
- | * requires different | + | * Functional languages fundamentally don't model how your computer works ⇒ harder to optimize. |
+ | * Different | ||
</ | </ | ||
</ | </ | ||
- | <hidden ↘ C# equivalent> | + | ===== References ===== |
+ | * http:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * [[https:// | ||
+ | * https:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * http:// | ||
+ | * [[https:// |
projects/fsharp_workshop.txt · Last modified: 2015/05/02 12:45 by mkucia