With the continuing popularity of functional programming, it doesn't look like it's ever going away. Here's is an introduction to functional programming in F# written with the object oriented (C#) programmer in mind.
My problem with these things (and I'm not picking on this particular article, just on introduction to functional programming articles in general) is that they always tell you how awesomely easy it is to make lists, or calculate the fibonacci sequence, two things I never have to do in the office.<p>What I want to know is whether functional programming languages would help me to write UIs better than C# does, to create XML documents from data, to retrieve data from web APIs and then display the results, etc.<p>These are things I have a need to do on a daily basis, and I'd like to know if F# is the tool for them, or if I should stick to C# unless I'm writing a list processor or calculation engine.
The article says<p><i>List.map function list - Invokes function on every item within list and returns nothing.</i><p>which isn't what map does in other functional programming languages. Applying a function and returning nothing isn't a very functional thing to do in general, as whenever possible functions should be called for their return values, not anything else they might do[0]. Map normally returns a list of the function applied to every element of the list. I looked up the documentation for F#'s map, and it appears to do the same thing:<p><a href="http://msdn.microsoft.com/en-us/library/ee370378.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ee370378.aspx</a><p>[0] And when possible, a function should <i>only</i> return a value, not do other things.
I would recommend "Why functional programming matters"[1] paper to anyone struggling to understand the purpose of functional programming. It's only about 20 pages.<p>[1] <a href="http://web.mst.edu/~tauritzd/courses/cs347/whyfp.pdf" rel="nofollow">http://web.mst.edu/~tauritzd/courses/cs347/whyfp.pdf</a>
One thing missed in a big way by this article and other newbies when it comes to (static) functional programming is the centrality of types. It really is what makes ml-derived languages special and it's a shame it's not promoted to non-functional programmers more. Most of your work is related to specifying your types, the rest falls into place naturally, and is why you can think and write code elegantly (and is super fun).