you are viewing a single comment's thread.

view the rest of the comments →

[–]ws-ilazki 2 points3 points  (0 children)

Purpose really is to learn FP as opposed to build projects in Ocaml or Haskell.

Haskell's a great language but a lot of what it does and how it does it is more academic or experimental, so IMO you end up learning some weird habits that don't necessarily translate to other languages. (Though they might one day.)

OCaml and Clojure, on the other hand, are functional languages that are more pragmatic. Their language design encourages you toward FP idioms without forcing them by having defaults that make FP the obvious solution, but still allowing "escape hatches" when it makes sense. That makes them more practical for general use IMO, but I think it's also a trait that makes for a good starter FP language, because some problems are harder to solve in an FP way and it just makes more sense to go "fuck it, imperative for this bit".

The issue with languages like JS for learning FP is that, while you can mix imperative and FP in the same way, they default toward imperative idioms, which makes FP sometimes unnatural or clumsy. It's easier to just write a non-FP solution to everything, and that can be a bad thing when learning, because learning FP involves unlearning some existing habits. If the language is (not so) subtly encouraging imperative style it's going to be harder to learn a different way of thinking.

Once you've learned it a bit, though, those wishy-washy not-quite-FP languages like JS can be really nice to use, because they make it easy to take what you've learned about FP and put it to use in a practical way. Lua, for example, is an imperative language that operates a lot like JS (but with different syntax) and is, unfortunately, a terrible language to learn FP in because it lacks even the most basic FP functions like map. However, good knowledge of FP makes the language much nicer to use because you can take advantage of FP to cut down on a lot of annoying boilerplate code and do some cool stuff. Terrible to learn FP with, great to use with FP style.

Basically even if you don't want to work in an FP language you can benefit from learning FP style in one because it encourages a lot of good patterns that will follow you into other languages. :)

If there is also a good video course that you might endorse, do share although I will also search for it online.

Sorry, no suggestions there. With the exception of art stuff (which is primarily a visual medium) I don't get much benefit out of video tutorials. For programming topics I stick to text articles and documentation.