I've been thinking about exploring functional programming. I'm not even sure what the benefits might be, but I'm curious, and want to learn more. The languages I work with currently are all procedural (python, c#, etc). What's the best language to start with?
views:
1146answers:
10Depends on the environment you work in and what you want to gain from it. I tried F# and its not bad. will get you up to speed and learning functional programming. From there you can move on to other languages/implementations that spur your interests or needs.
I'm not sure about Best, but at University we were taught Haskell.
http://en.wikipedia.org/wiki/Haskell_(programming_language)
LISP (or it's slightly more pure brother, SCHEME). When in doubt, go with the original ;)
Also, if you go with Common Lisp, you can learn a lot of new stuff in procedural stuff as well purely from how Common Lisp will implement procedural constructs with more flexibility, etc using functional techniques.
And don't get me started on the MetaObject protocol in Common Lisp that allows you to completely redefine the OO support of the language to support whatever you want as a first-class part of the language ;)
JavaScript can be functional. It was originally supposed to be much more Lisp like, but the decision was made to give it a C like syntax. Libraries like Functional JavaScript demonstrate this pretty well. I also has the added advantage of being an increasingly popular/useful language, unlike say, Lisp.
Go purely functional like Haskell, or go with Scheme (which lends itself to a slightly more functional usage).
That said, if you go with Lisp, Scheme, or Javascript, you will learn less about funcitonal programming, simply because you won't be forced into a functional paradigm like Haskell.
Since you say you know C#, then you might want to take a look at F#.
Without a doubt, your best bet is Scheme, for one reason: the SICP video lectures. Watching these videos is the most efficient (and most effective) way of wrapping your head around functional programming. The full text of accompanying book is also available online, but I'd recommend just picking up a paperback copy.
Once you've read SICP and played around with Scheme, other functional languages will be relatively easy to learn.
Python, Because you can consume functional programming paradigms at a milder pace. You can start solving problems without any functional programming, then start getting into it one step at a time.