HACKER Q&A
📣 cglong

Which functional programming language should I learn?


I have experience with most of the top languages in the TIOBE Index (OO and imperative, including the functional aspects a lot of these languages provide). I also have experience with native, JVM, CLR and several JS engines, so I'm not partial to a specific runtime.

I don't have a particular side project in mind, but I would like to strengthen my understanding of functional programming concepts through practice. Which language would be a good starting point for this? Thanks in advance :)


  👤 laurentl Accepted Answer ✓
I went through the same question a few months ago. I settled on OCaml.

Pros: it's reasonably straightforward to pick up, and it shines as a functional programming language. There are some good learning resources out there, e.g. Real World OCaml. I like the syntax much more so than, say, Haskell, but YMMV.

Cons: a very small std library, meaning you need to go with one of several 'battery' libraries. Feels less polished than mainstream languages in terms of user-friendliness (to be fair my reference point on both subjects is Python). A whiny post on these shortcomings: https://medium.com/@laurent.leconte/advent-of-code-2019-its-... (hopefully this gets me motivated enough to finish the follow-up post)


👤 0_gravitas
I personally adore Elixir and am always quick to recommend it, if not that I would say check out a LISP like Clojure or Racket, they offer a very different experience than Elixir, but I attribute how quickly I picked up on Elixir and FP in general to my previous (yet very very short) experience with Clojure.

👤 Mihalis
"Haskell

This is the whole new universe. It is very special, mind blowing, and completely different experience. I think learning Haskell is a very good idea. The core language is very elegant, and it brings on the table a lot of interesting concepts. If you know Haskell, it is not a problem to pick up any language. Haskell is the king. It is in the front line of computer science." [0]

I recommend going through [1] and once you get to monads switch pace and look for more resources.

[0] https://www.quora.com/When-do-I-use-Haskell-OCaml-Scala-and-...

[1] https://www.goodreads.com/book/show/912217.Programming_in_Ha...


👤 ColinWright
What have you already considered? For each one you have considered, what makes you hesitate? That will help us understand what sort of thing you're looking for so we can make informed recommendations, rather than everyone just naming their favourite.