This book is different from many other programming books available today. It doesn’t focus only on a specific programming language or library. Instead, it uses the presented languages and libraries to explain a way of thinking—a way of thinking that is becoming increasingly important and has influenced many recent technologies.
You may already know some of the concepts described in this book, because functional ideas appear in many technologies. Examples from the .NET world include C# 3.0 and the LINQ project, Microsoft Parallel Extensions to .NET, and the declarative programming model used in Windows Presentation Foundation (WPF). In this book we’ll build on top of your existing .NET and C# experience to explain the functional programming paradigm. We’ll introduce F#, Microsoft’s new functional programming language, and use it to turn abstract ideas into something more concrete. Where possible we’ll also use C#, because functional ideas can help you when designing C# applications.
If we’d been writing a book solely about F#, we could have simply organized it based on the individual language features and explained those features one by one. This book is about functional programming in general, so the structure is loosely based on ideas that form the functional paradigm. This is more difficult, because ideas don’t have clear boundaries and often overlap.
We’ve tried to select the ideas that we believe are the most important for newcomers to functional programming and then shape the book around them. This is particularly important in part 2, where we systematically look at functional values, higher-order functions, and the architecture of functional programs. This means that some examples that can be used to quickly demonstrate functional programming, such as working with collections of data, don’t appear in only one place. Instead, they’re developed gradually through several chapters after we introduce each new idea. We decided to use this approach because it shows how functional programming elegantly arises from a small set of simple concepts—just as functional programs themselves do.