As a programming-language adept I’ve been studying the ideas, concepts and theory of functional programming (FP) and FP-related languages for about 2 years now, still learning new things everyday.
Recently a ‘FP User Group’ was started by some people at Ghent University, called GhentFPG, and the first meeting took place last thursday, with great interest from students, university employees as well as people working in the industry. You can find some more info in the GhentFPG Google Group or in the wiki (where you can also find the slides of the presentations given during the first meeting).
Some days ago someone new to FP posted a message on the mailing list, asking which language he should study, among other things.
Since I think my reply might be of general interest (also outside GhentFPG), I decided to post a copy on this blog as well (note I did add some extra markup). Comments welcome!
Based on my experience (which is biased, obviously):
Functional Programming is not only a language-related thing. FP
languages do enforce you to apply functional paradigms, but you can
easily follow these paradigms in lots of other (more mainstream?)
languages as well: it is easier to learn people a paradigm using a
language they already know, rather than telling them FP is really cool
and useful and interesting, but requires them to learn a new
language/toolchain/… first.Not talking about Java or C++ or something similar here, rather Python
and Ruby.If you’re into Java/C#/…, Scala is a really good introduction to FP:
it allows you to write OOP code just like you do already, but also
provides you lots of FP-related features, and pushes you gently into the
FP approach. The book “Programming in Scala” by Odersky et al. (the main
author of Scala) is IMO a really good intro to both Scala as well as the
FP concepts it provides, not only showing them but also explaining
gently why they’re useful, and why they’re ‘better’ than the approaches
you’re taking already.The Scala type system is rather interesting as well.
It’s the gentle path, so you want Learning Scala before reading
‘Real World Haskell‘ certainly helped me a lot to understand the latter.Haskell is an incredibly interesting language because of the concepts
it adopted and types it provides, but it does require an immediate mind
switch when coming from a non-OOP world (I once spent about 2 hours to
explain a Java-guy how classes and instances in Haskell relate to
classes and instances in Java, it wasn’t obvious). “Real World Haskell”
is certainly worth a read (and if you read “Programming in Scala” as
well, you’ll notice lots of similarities).I for one can read Haskell code pretty easily and learned lots of
CS/math things thanks to learning it, but I’m (still) unable to write
non-trivial code (I need some good project to get my hands dirty I
guess).Erlang is really interesting from a (very specific) feature
perspective: high-availability, distributed computing, the actor system
and the OTP library on top of it,…It’s a rather ‘old’ language, but I kind of like it. Some people do
complain about the syntax, but once you figured out ‘,’, ‘;’ and ‘.’ are
used almost the same as they are in ‘human’ written language, everything
becomes obviousDo note though Erlang is not a normal general-purpose language. You can
code +- everything you want using it, but it’s really targeted to
distributed/high-available/network applications. You most likely won’t
use it to solve mathematical problems or write a game. It’s really good
at what it’s built for though.One final note: please don’t ever make the mistake I made. If you know
Erlang, and take a look at Scala (which also has an actor library in the
standard distribution, as well as the more advanced Akka-library), don’t
judge Scala as being a competitor for Erlang, they’re both completely
different languages targeting different applications. ‘Scala’ is not
about ‘scalability’ as Erlang is (it’s a “Scalable Language”).F# (and most likely OCaml as well, although I never used it though) is
certainly worth a look as well. I only read 3/4th of a book on it, but
it looks really promising and interesting.There’s obviously all sorts of Lisp dialects. I have no opinion on
them, never looked into any Lisp closely enough. I only wrote some
Clojure (a Lisp-dialect for the JVM) code one day, but need to learn
more about the Lisp-way of programming. Clojure seems to be interesting
because of the deep integration of Software Transactional Memory (STM)
in the language (yet another approach to concurrency ).As for the IDE question: Vim and a decent terminal are all you need,
luckily none of the above languages require you to learn how to use a
toolchain which enforces you (or some magic IDE) to write 500 lines of
XML-based build ‘programs’ or other insanities.My advice: pick some language, learn it, but make sure you don’t only
learn the language, but especially the concepts (type system,
higher-order stuff, list manipulation,…). Then pick some other
language and learn it as well (which will be easier since you got the
concepts already) and so on.And read tons of papers available on the internet in between Even if
you don’t understand a paper completely, you’ll pick up some things
already, and re-reading it 2 weeks later helps a lotJust my .02,
Nicolas
Personally, I don’t much like the ‘pure’ functional languages – I’ve played with both Haskell and Lisp briefly in the past, and never got my head around them. That said, I do have a lot of appreciation for the functional features of more hybrid languages like Python or Scala… used sensibly, they can make for highly concise and readable code…
As for the good Project in Haskel join xmonad a tiling windowmanager which is quite fast…
Functional programming is not my thing, although a hybrid like Python is quite useful.