Update: Added new Hanselminutes show on F# and other links
With the new year comes new challenges. Recently I've been looking to take my background in statistics and get back into graduate school. With those days brought the days of functional programming, pattern matching and all sorts of things. So, with that, I began to look at F#.
Why F#?
No, it's not because it's shiny and new and everyone's talking about it. To a point, it made me more aware, but I won't just hop on the next best thing without a real reason for learning it. Bettering myself sometimes isn't reason enough because when I learn something, I want to naturally go deep, and not just gain a superficial knowledge of it. I'll cover more about my philosophy in a later post.
To me, F# a natural fit for a lot of things in my background. As stated before, I have a bit of simulation and number crunching in my background as part of my college life.
But, also, I've been into High Performance Computing with both MPI (MPICH2) and OpenMP. But, I was tiredof having to program in C or Fortan as it's not my favorite and it's like stepping back in time if I need to do something complex. I've even go as far as to wrap the Microsoft MPI API just so that I could program .NET application on Windows Compute Cluster. That was actually quite fun as I was able to calculate PI and some prime numbers with my .NET libraries. What I wanted with that was a mirror of the BOOST MPI libraries and I got it going pretty well, even with generics.
Another motivator of mine to learn F# is that functional languages such as this are perfect for creating Domain Specific Languages (DSLs) and other languages. This could have easily helped in some of my past projects which have included finance and health care. Such as scenario is covered in Robert Pickering's F# book which will appear below.
Where to Start?
So, naturally many people don't know where to start with their F# knowledge. Before you begin, you should understand that F# doesn't operate on Object Oriented principles like many are used to. Instead, it operates on Functional Programming Principles. If you're familiar with Haskell, Lisp and Erlang, you should be pretty familiar with the concepts. In case you aren't, here are the basic concepts:
-
Avoids state and mutable data
Emphasizes the use of functions with no state -
High-order Functions
Functions are high-order when they can take functions as parameters and return functions. -
Pure Functions
Functions are pure functions when they have no side-effects, meaning it accepts no input, produces no output and no external devices accessed. Can operate in parallel quite freely -
Recursion
Although we know it from the OO world, it really shines in the Functional Programming space. Recursion allows the function to call itself to be called over and over.
F# Links
I have compiled a pretty comprehensive list that allowed me to learn F# in a relatively short amount of time. Then again, I've dealt with functional programming before, so there was minimal learning curve.
So, let's get started with the links:
Sites
-
F# Home Page
Includes introduction, wiki and downloads -
F# Wiki
Wiki run by Robert Pickering -
hubFS: The place for F#
F# blogs and news -
Tomas Petricek's introduction to F#
Covers Functional Programming, Imperative Programming and Language Oriented Programming
Downloads
-
F# Download
Integrates with Visual Studio 2005 and 2008 -
F# Samples
Factorials, Fibonacci, forms and others -
F# Web Tools
Author web applications, workflows, etc with F# -
F# Tutorials
3D programming, games and more
Articles
Podcasts
- DotNetRocks - Jon Harrop Makes us F#
- DotNetRocks - F# Moves Forward
- Hanselminutes - F# with Robert Pickering
- Hanselminutes - Starting Small with F# with Dustin Campbell
Blogs
-
Don Syme's Blog
F# creator's blog -
Jomo Fisher's Blog
F#, LINQ and whatever -
Robert Pickering's Blog
Author of Foundations of F# book -
Jon Harrop's Blog
Author of F# for Scientists book -
Granville Barnett's Blog
Another F# blogger -
Tomas Petricek's Blog
Phalanger contributer and F# blogger -
Did it with .NET Blog
Dustin Campbell's blog with F# samples
Books
-
Foundations of F# (Robert Pickering)
A basic introduction to F#, although needs a little bit more polish -
Expert F# (Don Syme)
Good introduction and actual applications of F# programming -
F# for Scientists (Jon Harrop)
To be released May 8th, 2008, but looks like a great read
Conclusion
I hope this gives you a good foundation of what you can do with F# and what it's really good at. Will it replace your C# applications, no, that's not its mission in life. But, if you have the need for DSLs or generally interested in higher power calculations, grid computing, recursion, etc, then F# is the place for you. Did I miss anything? In the coming weeks, I'll start diving into more of F# goodness, showing the basics and getting some things going. Until next time, develop, mentor and inspire!
kick it on DotNetKicks.com
