A few weeks ago Dr. Jon Harrop published F# for Scientists and I had the fortune of snagging a copy at work. In short, it is an excellent book and an invaluable resource for those working in quantitative computing.
The best feature of the book is its conciseness and clarity. Given F#’s immense multi-paradigm nature it is impossible to cover everything in only 300 pages, so the book skips object-oriented programming and doesn’t do a thorough job covering F# syntax. Rather, the book covers just enough F# to solve scientific problems using the functional style. (And highlights just how well suited for science F# truly is!)
This focus on scientific computing however is also the book’s main (potential) flaw. If you consider yourself a scientist, then this book will teach you everything you need to know about F#. But if you are a .NET developer looking to integrate F# into your projects, you might find the book’s coverage of the language a little lacking. (Specifically in how to do object-oriented programming in F#.)
What impressed me most was just how clear the examples were. I haven’t had a lot of functional programming experience before working on F#, and I found the examples in the book to be very instructive on how to write ‘good’ functional code.
For example, an interview question I sometimes ask is to write the power set of a list in C#. There was a implementation of this in the book and I was floored to see it so concisely written.
let rec powerset =
|  -> [  ]
| h :: t ->
[ for subset in powerset t do
yield! [subset; h :: subset] ]
> powerset [1; 2; 3];;
val it : int list list
= [; ; ; [1; 2]; ; [1; 3]; [2; 3]; [1; 2; 3]]
After reading the book I feel a inspired to use F# for more scientific-type applications.
If you are looking for a comprehensive overview of the F# language, this book isn’t it. But if you are at all interested in using F# for science I absolutely recommending it.
Edit: Evidently the super-elegant powerset implementation could be even more elegant. Does that make it super-duper-elegant?