Functional Programming Languages

8 points by big_data ↗ HN
Faced with many choices, help me decide which functional programming language to learn. Just as important as making a recommendation, please tell me why you made your choice. For kicks, saying don't bother is also a choice.

14 comments

[ 2.6 ms ] story [ 40.3 ms ] thread
What do you want to do? If you can only learn one "functional" language and you do anything with the web, I'd recommend Javascript (if you don't already know it). It's viable in the front and backends.

I'd personally recommend Haskell. It's going to stretch your brain (in a good way), and helps reinforce all the "functional" concepts. It's one of the very few purely functional languages, and it does have a bit of a learning curve to get started with, but I think it's worth the work. There's a lot of library support, and almost all the sample code you find online in tutorials is well written. You can pretty much do whatever you'd like with Haskell (Web servers like Yesod, to all kinds of fun AI/ML stuff). If you're into computer science theory, you'll find as much as you'd ever want with Haskell. The GHC (compiler) has particularly good support for concurrency and parallelism (likely in most cases as good or better performance than Erlang).

If you're a quant looking into building a trading algorithm OCaml is a good choice.

My short term ambition is to really learn the paradigm in order to become a better programmer overall. Where it will lead long term, it's hard to say at the moment.
Then learn Haskell. It's the most academic functional language and there's constantly new papers written pushing the frontiers of computer science. It's also one of the most pure functional languages, so if you can grok Haskell you'll "get" the functional style.

Some notes for learning Haskell. Start with 'Learn You a Haskell for Great Good' (http://learnyouahaskell.com/chapters). Then move on to 'Real World Haskell'. Then 'Write Yourself a Scheme in 48 Hours'.

Eventually you'll learn about Monads. They aren't as hard as most people claim. They're very abstract, and require you to think differently about things. There are plenty of great monad tutorials out there. Read one every night before you go to sleep. One day you'll wake up and it will all make sense.

The key for learning your first functional language is to forget everything you know about programming, and embrace the fact that you're starting from scratch. Otherwise "Returns" and using recursion instead of loops might trip you up. It's not "Hard", it's just different. If you're prepared, it's not a difficult journey, and you'll be a better programmer for it.

Awesome advice, I thank you!
I dont know anything about your background, but I suspect that Haskell will have a mind altering effect.

That would be my suggestion.

Ocaml is probably the one at the sweet spot since its fairly practical (reasonable number of libraries and a good compiler) and has a simple-but-effective core type system (ADTs + modules). Plus you can transition to F# later if you want more libraries. Haskell wouldn't be a terrible choice either -- just be warned that it is more difficult and idiosyncratic (laziness + type classes + monads + random GHC extensions that do strange things).
What about starting with F#? Because it's M$FT, there might be more appeal for the skill from an employment perspective.
Could do that too, but it doesn't have a module system (it just uses the CLI's mechanisms, which aren't that great). A good module system is worth knowing, even if you ultimately aren't able to use it for practical reasons.
I will definitely look into this. Thanks!
Haskell has definitely been the most rewarding programming language to learn for me personally. It's fairly unique in many ways, and really forces you to think in functional terms (unlike many other functional languages, which make it easy to drop back to OO or imperative style).

However, Scala was the "gateway" language that helped me grok the core functional concepts after a long history of doing just OOP.

Thanks to all for responding. Haskell it is for now.