Thanks to everyone who wrote a review or posted a comment about the Real-World Functional Programming book. Thanks to the Manning Early Access program, the book was available to the readers even before it was completed, which gave us some very valuable feedback.
Real-World Functional Programming is a book by Tomas Petricek and Jon Skeet. It’s terrific. It succeeds not just as an introduction to functional programming and F#, but also as a simply excellent programming text. [...]
Readers will not only learn the ideas, but also get trained to see applications for them, as well as acquiring knowledge of the tools. This book is my candidate for the best programming book of 2010.
Overall, this is an amazingly good book that puts into words the many benefits of the functional paradigm, and shows that the F# programming language can embrace both the functional and object-oriented styles of programming. C# programmers, too, can gain something from this book, using it to understand the ideas behind LINQ and lambda expressions and why these have been incorporated into the language. I’m going to be re-reading it and working through the examples in more depth in the near future.
I really enjoyed reading this book – it’s my first real foray into the world of functional programming since university and I think I understand the functional approach to programming much better than I did back then from reading this book. [...]I’d certainly recommend this to any .NET developers curious about learning how to apply ideas derived from functional programming to their C# code and indeed to any developers looking to start out learning about functional programming.
Real-World Functional Programming teaches a paradigm using a functional language and not the other way around. There are better books to learn all of the ins and outs of F# but it would be just like reading a book on C# without understanding OOP (Object Oriented Programming).
So if you’re a software developer that’s looking how to improve your ability – even if you’re not interested in F#, hack even if you’re not even a .NET developer – read this book!
It’s one of the rare cases which left me with a headache, the pleasant kind of which is left after learning something new. It is set in the .Net world, but I can only recommend it to everyone, as it offers a remarkably well written way into functional programming.
You will never look at your code in the same way again!
.NET needs more functional programmers…this book shows you how to become one.
Warning: this book has a very high Wow! factor. It made my head hurt…in a good way!
I recommend it to all software crafts people, not just .NET developers.
A truly functional book!
A hallmark of this book is a very pragmatic, Rosetta stone
approach to F#.
This book goes out of the way to make C# developers feel comfortable with the new .NET language. I would recommend this book to anyone who is trying to get out of the same old boring stuff and move on to something truly innovative and exciting!
Better still, it’s a terrific resource for helping convince the rest of your team of the advantages of adopting a functional approach and F# as a language. I can think of few better reasons for getting this book immediately!
Are you curious about the book and want to see how it looks like? The following two chapters are available as free samples. They are nice demonstration of the mix of theory and practice that you'll find in the book:
The chapter I below of the material is based on chapters 1, 2 and 3 of the book. The remaining chapters are newly written material that focuses on real-world examples of using F#.
This chapter explains the basic concepts behind functional programming and the F# language. Many of the concepts are demonstrated in C# to guide programmers without prior experience with F# or functional programming.
The chapter explains concepts such as immutability, first-class functions and expression-based programming. It shows the benefits of functional programming that follow from these concepts – such as the fact that they make testing and reasoning about programs easier.
The shift towards the software as a service means that an increasing number of applications need to be written as servers. This chapter explain server-side development and agent-based concurrency in F#.
The chapter introduces F# agents (the
MailboxProcessor type). It includes a tutorial that develops a simple chat server using agents, encapsulates it into a reusable .NET object and exposes it as a web page using the
HttpListener type. The chapter also includes two reusable agents that solve common data processing tasks.
A lot of code assumes that it’s in the driving seat—that it controls what happens at each step. This model breaks down for user interfaces. This chapter explain how to write reactive UIs in F# using Silverlight.
The chapter explains two approaches to writing reactive applications in F#. The first approach is declarative and it composes data-flow using event combinators. The second approach is more imperative and it describes control-flow using asynchronous workflows. The chapter also covers practical aspects, such as how to use F# with XAML.
Thanks to its scientific roots, F# is a perfect langauge for numerical computing. This chapter explain how to use .NET libraries such as Math.NET Numerics, Sho, and F# Power Pack to implement numerical algorithms in F#.
The chapter explains what makes F# a great language for numerical computing. Then it introduces various numerical .NET libraries that can be used from F#. It presents a large number of examples using Microsoft Sho and Math.NET Numerics. (This chapter was written by Yin Zhu.)
Most of web applications work with data in one way or another. F# is suitable for developing a data-processing parts of web applications. This chapter explains how to use Data and Web technologies from F#.
The chapter uses F# to develop the model and controllers of an ASP.NET MVC web application with a front-end created using C# and Razor. It shows how to use asynchronous workflows to write more efficient web pages and how to easily access SQL database using dynamic operator.
This chapter explains how to create charts in F# using the .NET Chart Controls library, F# wrapper for the library named FSharpChart and other technologies such as Excel.
The chapter describes .NET Chart Controls library (including topics like data-binding) as well as the FSharpChart wrapper that has been designed specifically for F#. It includes numerous larger tutorials, such as visualization of financial data, and How To articles that show how to create common chart types.
The full source code for all the examples in the book is available for download here. Have a look at some of the examples to see if the book is interesting for you!
The following articles were published as chapter excerpts. The articles are based on early versions of the book, so they may contain more bugs, but they present some important features of the book.
F# asynchronous workflows can be used to solve a wide range of programming problems. In this article we’ll look how to use asynchronous workflows for elegantly expressing the control flow of interaction with the user. We’ll also look at clear functional way for encoding drag&drop-like algorithm.
The Functional Programming for the Real World book explains essential concepts of the functional programming paradigm using examples in C# 3.0 and F#. In this article we look at one very important advantage of using one of the core functional concepts – immutability.
The Real World Functional Programming book explains essential concepts of this paradigm using examples in C# 3.0 and F#. In this article we look at immutability, which stands behind the clarity of functional programs.
In this article, I’ll talk about two properties of functional languages that together define the overall style of writing functional code – recursion and higher-order functions. These two concepts together define what a declarative programming style is, so after discussing them, we’ll talk about the benefits of this style.
This article looks at several aspects of FP and how the same concepts, which are essential for the functional paradigm, look in the F# and in C# 3.0 with LINQ. We will shortly look at the basic programming language features like lambda functions and type inference that are now available in both F# and C#.
I tried to minimize the number of errors in the book as hard as I could. However, some errors are (unfortunately!) inevitable. This page contains the list of known issues. If you spot an issue that isn’t listed on this page, please send me an email at firstname.lastname@example.org.
Type<T1, T2>class from listing 3.7, we implement it as an extension method.” The name of the class isn’t
Type<T1, T2>, but should instead be
hd::tailshould instead be
head::tail, because the code uses the
headname later on:
match list with |  -> init | head::tail -> let resultRest = aggregateList op init tail op resultRest head
List.ofseq, which is a wrong name. The correct name of the function is
List.ofSeq(with uppercase “S”). The line should look like this:
let cells = List.ofSeq(csvLines.Split(','))
MeasureString, we give it
lblvalue as the first argument, but this value isn’t declared anywhere. It should be the
let size = gr.MeasureString(title, fnt)
List.map(5)”. The bullet number should be (4)
mapfunction instead of the inner
matchparameter instead. The line should be:
| Some(first) -> readInput() |> Option.map (fun second -> first + second)
match opt with, but it should be
match input with.
Client: John Doe, q=16, but the actual output should be
Client: John Doe, loan coefficient: 16
mapfunction, the last line (
map' f list ) should be indented one level less (to match with the
List.intthat we discussed in listing 10.2.” The
DataMemberproperty to the name…”. The name of the property should be
DisplayMember(the listing itself is correct).
tableArr. The correct version is:
worksheet.Range("B3", "B" + endColumn).Value2
tradefunction in the F# Interactive output is
val trade : int -> string -> Contract. The two input arguments are swapped and the correct type signature is
val trade : string -> int -> Contract.