Welcome to The F# Survival Guide. The purpose of this Web book is to provide a solid foundation and pragmatic introduction to F# programming and its functional underpinnings.
I wrote this book with the intent that it is the first book you read in your F# journey. Along these lines, this book covers the entirety of the core F# language, as available November 2009. It covers all of the documented (and some of the less documented) concepts, keywords, constructs, types, and language symbols. In addition, I have tried to provide short examples that capture the essence of the topic at hand, while at the same time discussing real-world impacts. My hope is that after reading this book, you will be able to develop non-trivial applications using F#, and will be able to readily extend your learning via additional resources.
Why This Book?
While there are several books in print, and some Web-based resources for learning F#, I have not found a single one that’s altogether clear, concise, and easily digestible by mainstream developers. Few, if any, of these resources takes a bottoms-up approach, methodically building up a conceptual and practical framework that builds skills and confidence in a systematic way. Additionally, most of the F# materials that I’ve read are to some extent academic, with a bent towards describing F# in terms of esoteric constructs (check out the Maybe monad on the Web for a good dose of newbie confusion!). In my (humble) opinion, much of the existing material doesn’t resonate naturally with OO application developers. These are the issues that I’ve tried to address with this book.
Also, whenever I read technical books, I ultimately have questions that roll through my head as I go. The books I tend to love anticipate my “rolling questions” and answer them quickly and clearly. I will do my best to anticipate your rolling questions and answer them in kind. I’ve also made
it a point to keep the chapters relatively short, covering one or two related topics at a time.
Lastly, I tend to dislike books that introduce new concepts and syntax without first establishing a solid foundation. One of the goals I have for this book is to wait until I’ve covered a topic before using it in examples, etc. I get frustrated when books throw in a new concept in the middle of an example – it’s very distracting and usually takes away from the point that the author is trying to make. Therefore, I will use data structures, syntax and concepts only after we’ve discussed them. Because certain language features are so highly interconnected, this may not always be possible; however, I think we can go a long way here.
Instead of lamenting over the dearth of palatable materials and complaining about what I don’t like (that’s too easy), I’ve decided to do something about it and contribute to the development community as best I can. I’ve chosen this particular topic because I feel quite strongly that functional programming will play prominently in the next decade of computing. Why? Two words: multicore processors.
In order to increase compute speeds and throughput cycles, technology manufacturers such as Intel, AMD, Dell, HP, etc. have taken to shipping computers with multiple CPUs and CPUs with multiple cores. Given this trend, it is not unreasonable to assume that near-future desktops will contain 8, 16, 32 and more cores. Beyond the desktop, there is “the cloud”, with virtually unlimited computing resources available.