Get back, he’s got a book

Professional F# 2.0 by Ted Neward, Aaron Erickson, Talbott Crowell, Richard Minerich

This book seeks to be an introduction to F# and functional programming for C# programmers. Maybe it is because the book was written by so many people, but I found some parts of the book really good and some parts really uninteresting and not at all illuminating.

The first chapter is a primer which starts with a simple C# example and gradually converts it into equivalent F# code, stripping away all of the ceremony that you are forced to add in an object oriented language. This chapter introduces the notion of a function as a first class object, and shows how the type inference keeps the code looking a lot cleaner. Personally, I’m not sure that it really works, though the eventual contrast between the initial C# and the final F# is certainly a good advertisement for the brevity of F#.

The next chapters introduce the various datatypes and primitives of the F# language. There are a few annoying errors… approximating the distribution of three rolls of a die using a random number in the range 3-18 is not something you really want to do, as the latter has a completely different distribution. The coverage of classes and interfaces, followed by the subject of active patterns is really good.

Again there are a couple of annoying typos, in particular the derivative of a function is defined as
  (f(x+h) – f(x-h)) / 2 * h
instead of
    (f(x+h) – f(x-h)) / (2 * h)
There are also several illustrative pieces of code which are not explained and which I couldn’t link to the discussion at that point in the tutorial.

There are good chapters on linking F# and C# code, and short chapters on using F# in practical scenarios such as ASP.NET MVC and implementing web services.

I’ve done a fair amount of F# in the past, and this book contained some really good explanations. However, the style and content was a little variable, presumably depending on the author of that particular part of the book, which made it hard to read.

Advertisements
This entry was posted in Books. Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s