Started F#

Where to start is the question, and here is a short intro from the best sources I could find:

1. Don Syme’s weblog

He is the creator of F#, and emphasizes the succint and expressiveness of the language.

F# makes three primary contributions to parallel, asynchronous and reactive programming in the context of a VM-based platform such as .NET:

(a) functional programming greatly reduces the amount of explicit mutation used by the programmer for many programming tasks
(b) F# includes a powerful “async” construct for compositional reactive and parallel computations, including both parallel I/O and CPU computations, and
(c) “async” enables the definition and execution of lightweight agents without an adjusted threading model on the virtual machine.

2. Chris Smith’s Programming F# book in 20 minutes Part I and Part II

Notes from the book:

* F# supports functional programming, tells what to do, not how to do.
* F# supports imperative programming


let functionalSum numbers =
  |> square
  |> Seq.sum

let imperativeSum numbers=
   let mutable total=0
   for i in numbers do
     let x= square i
     total <- total + x

* F# supports OO programming, you can abstract the code into classes and objects.
* F# is a .NET language with all libraries, Garbage Collector, and CLI.
* Everything is immutable by default, so you can experience side-effect free development.
* F# is statically typed, at compile time you have the type-safe code.
* Take care of:
–  the order of the files of your project in your solution explorer, they will be compiled from top to bottom.
– indentations, as there are no curly brackets, the indentation will define the scope.
– also F# is white-space significant, and case-sensitive.

3. An introduction to F# at Channel 9 by Luca Bolognese. Notes from the presentation:

You went to counter, and told that you want a cappucino, and start to tell “Now you grind the coffee, and get the water, warm it. At the same time, prepare the milk, but I want those things go in parallel.”

Three key things he emphasizes:

1. let keyword bind a value to a symbol

let sqr x = x * x

2. Arrow “->”, similar to “=” in C# for assigning value; but it is more specific: it means you are pushing something inside the location in memory, not working with symbols any more.

let addBalance x=
    let balance =0.0
    balance <- balance + x 

3. fun: Function/lambda expression as in c#

(fun x->x+3) 7;;

which takes 7 as parameter and returns 10 or (fun i->i*2) [1..4]

which return [2,4,6,8]

4.Don Campbell’s blog about why he loves F#

5. The F# community, HubsFs

6. F# at Microsoft Research

7. Phil Trelford’s session at EdgeUG talk, with nice F# samples.

Anything I have missed?


2 thoughts on “Started F#

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s