Hacker News new | past | comments | ask | show | jobs | submit login

I want to seriously invest some time into properly learn a functional language.

My goals are simple- write small scripts, solve programming problems in sites like Codewars, Leetcode, Euler Program, etc. And yes, having the "functional enlightenment" or something similar.

Which language should I learn and invest time into? Scala, Clojure, Haskell, OCaml?




Learn Haskell, it's the most elegant, and if you're using it for LeetCode / project euler you can have the experience of polishing a simple elegant program until it shines. It's a very satisfying experience.

Also, Haskell is lazy, which is fun and very different from other languages you'll use.

If you become a Haskell afficionado, it also kind of acts as a secret handshake in interviews. Like, you aren't going to be programming in Haskell here, but "you get it"


Functional programming is not really a single paradigm. In particular lisps and ML style languages are very different and you should try both. Scala is still a C-style language at heart, it's just much further along the borrowing ML features path than most.

I'm not super familiar with the contemporary lisp landscape but scheme is the traditional choice for teaching.

Among MLs I would definitely pick Haskell.


Haskell. I prefer Scala as a language to do productive things. But if you want to learn a pure functional style (that you can apply in Scala later as well) then Haskell is better becaue it forces you into this style. Few other languages do that.


Dissenting vote: Scheme (or Racket).


Thanks to everyone who answered.

And I now notice that autocorrect made Project -> Program. :/

I will keep a watch here for more responses.


Haskell.


Among the ML descendants, I suggest Scala 3, because it has essentially all the power that we like in Haskell, (HTKs, good support for ad-hoc polymorphism), but runs on the JVM, a mainstream platform with a vast library ecosystem.


I haven’t used Scala in a long time, and I’m guessing it isn’t as gross now as it was in 2014.

Your point about the vast library ecosystem might be valid. Personally, there has only been one time in several years working with Haskell I’ve wanted to use a library that I couldn’t find an analog to in Haskell. It was WeasyPrint which is a Python thing, and there was no problem to run it from my Haskell program as an external process.

Although thinking about this some more, I probably could have just used Pandoc…




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: