I remember my first time getting in touch with the F# language was Don Syme’s session Parallel and Asynchronous Functional Programming on .NET with F# at TechEd Europe 2007. LINQ was about to be released at the same time and - slowly but steadily - functional programming paradigms were about to enter .NET programming realms.
Nevertheless, it took me quite a while (meaning: years) becoming accustomed to functional programming techniques and using them on a day to day basis. Today, a good part of the C# code I write makes use of functional programming techniques. Realizing that, I asked myself: “Why not use a language which was designed for functional programming purposes in the first place?” And F# was the obvious answer to that question.
So, quite a few years after I had come across that language for the first time, considered it interesting but hadn’t done anything useful with it, I decided to get my hands dirty and write some actual code using F#. And what can I say: the sheer beauty of code like this had me at “Hello (World)”.
There are many resources on the web making it easy getting started with that language. Just recently Try F# was launched, giving you the chance to interactively explore the language in your browser. But if you’re looking for a systematic way to explore and understand this language from ground up, I recommend reading F# Succinctly.
This book is part of the Succinctly series, which is a series of free eBooks on different development topics, each of them covering a specific topic in a concise and pragmatic way on about 100 pages. All available books in this series can be found here.
F# Succinctly is well structured and organized, helping the reader diving into this new technology easily. It starts with the basics of installing and using the F# compiler or Visual Studio integration correctly. Also, the F# Interactive console is explained early in the book which is an important detail because this console is a tremendously useful tool for exploring the language.
After these basic steps functional programming (FP) patterns and techniques are explained. This is done in a pragmatic way providing code examples and not spending pages and pages on the mathematical background of FP. Essential techniques like recursion, pattern matching and currying are explained within a couple of pages, giving the reader just enough knowledge to get started but not overwhelming him.
With these FP fundamentals covered, the F# language itself gets explained in more detail to make the reader familiar with the language’s structure and syntax.
The rest of the book deals with integrating F# code into existing code bases written in object oriented languages like C#. This is the part which makes this book really stand out because such scenarios are the typical pitfalls for beginners. Questions like how to integrate F# with frameworks like WPF, ASP.NET or just generally object oriented libraries are covered and demonstrated using real world examples.
Finally, there is a good reference with links to websites and books providing further and more detailed information on programming in F#.
This book provides a nice introduction to the F# programming language and to functional programming in general. It can be read cover to cover within a couple of hours giving you all the necessary information to get started. And it’s free. So, there’s actually no reason for not reading it.