User Tools

Site Tools


projects:fsharp_workshop

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
projects:fsharp_workshop [2015/04/17 23:03] mkuciaprojects:fsharp_workshop [2015/04/18 17:32] mkucia
Line 1: Line 1:
 ====== F# workshop ====== ====== F# workshop ======
 +{{:projects:fsharp_logo.png?nolink|}}
 ===== Prerequisites ===== ===== Prerequisites =====
     * https://www.linqpad.net/ or anything that can execute a REPL((Read, Evaluate, Print Loop))     * https://www.linqpad.net/ or anything that can execute a REPL((Read, Evaluate, Print Loop))
Line 22: Line 22:
 hello hello
 </code> </code>
 +
 +F# (pronounced “F Sharp”) is 
 +
 +<WRAP group>
 +<WRAP half column box>
 +  * Open Source
 +  * Multi platform
 +  * Modern, rising popularity
 +  * Lazy evaluated
 +  * Reusable
 +  * Concise (See [[http://theburningmonk.com/2014/12/seven-ineffective-coding-habits-many-f-programmers-dont-have/|signal-to-noise ratio]])
 +  * Strongly typed
 +  * Functional first
 +    * Use functional to write easy to test and understand code
 +    * Use imperative for performance and compatibility
 +    * Use objective for organization and encapsulation
 +  * Compiled
 +</WRAP>
 +
 +<WRAP half column box>
 +  * Not suitable for real time (unpredictable performance)
 +  * Hard to optimize (Functional languages fundamentally don't model how your computer works)
 +  * Functional first (different thinking process, you will need to re-learn)
 +</WRAP>
 +</WRAP>
 +programming language for writing simple code to solve complex problems. 
  
 <code fsharp> <code fsharp>
Line 28: Line 54:
 </code> </code>
  
 +Introducing pipeline operator:
 <code fsharp> <code fsharp>
 let hello x = printfn "Hello %s" x let hello x = printfn "Hello %s" x
 "World" |> hello "World" |> hello
 </code> </code>
-''|>'' is the pipeline operator+ 
 +<hidden pipeline operator definition> 
 +How to define the operator?  
 +<code fsharp> 
 +let inline (|>) x f = f x 
 +</code> 
 +</hidden>
  
 <code fsharp> <code fsharp>
Line 57: Line 90:
 </code> </code>
  
-===== Why? =====+Note that F# uses indentation to indicate block structure. Find out more [[http://fsharpforfunandprofit.com/posts/fsharp-syntax/|here]].
  
-<WRAP group> 
-<WRAP half column box> 
-Pros: 
-  * Open Source 
-  * Multi platform (Mono, .NET core) 
-  * Modern, rising popularity 
-  * Lazy evaluation 
-  * Reusable 
-  * Reduced code (See [[http://theburningmonk.com/2014/12/seven-ineffective-coding-habits-many-f-programmers-dont-have/|signal-to-noise ratio]]) 
-  * Strongly typed 
-</WRAP> 
- 
-<WRAP half column box> 
-Cons: 
-  * Not suitable for real time (unpredictable performance) 
-  * Functional languages fundamentally don't model how your computer works ⇒ harder to optimize. 
-  * Different thinking process (you need to re-learn) 
-</WRAP> 
-</WRAP> 
  
 ===== References ===== ===== References =====
projects/fsharp_workshop.txt · Last modified: 2015/05/02 12:45 by mkucia