Monday, March 24, 2008

Getting Started with F#

I've playing around with a few different functional programming languages and have settled on F# for the moment. It is essentially a port of Objective Caml onto the .Net platform. Coming from a Java background this kills two birds with one stone for me; it will give me a little intro to .Net and will allow me study a functional programming language in more depth.

F# has been developed by the Microsoft research group with means the compiler and associated tools are already of a pretty good quality. There is also a plugin for Visual Studio providing code completion, syntax highlighing etc. Although I'm not a big fan of VS, it is better than a text editor. The great thing is that you can effectively get a free (non-evaluation) F# IDE by downloading the empty Visual Studio shell and then add the F# plugin. First grab the Visual Studio shell (i.e. this doesn't contain C# or any other language) and then download F#. For more details read here.

Once you have installed this lot, you should see new 'Microsoft Research F# ...' item on your start menu. The best thing to do is play around with a few simple expression using the F# Interactive Console (which can also be run from within Visual Studio). For example type the following at the prompt:

printfn "Hello world";;
So what next? Most of the F# books cost quite a bit of money, so I'd recommend initially looking at some of the free OCaml ones. The core language is so similar you should be able to make quite a bit of progress before having to spend any money. Try an Introduction to Objective Caml and Developing Application with Objective Caml.

Finally a good resource is the F# wiki.