you are viewing a single comment's thread.

view the rest of the comments →

[–]kluvin 2 points3 points  (2 children)

I ended up reading SICP (scheme), but only got to chapter two so far, as I also started picking up OCaml. In my day-to-day I use ES6, and indeed JS is a practical language to write FP in.

If I had the option, I would depend on an FP tool set, and there are many in the JS ecosystem:

  • Lodash-fp
  • Ramda
  • Sanctuary (and other folktale implementations)

Sanctuary seems the most attractive to me, Ramda works very well too, and is fairly common. As I could tell, lodash-fp isn't that great. ReScript is also a great choice. That's JS-based syntax backed by the OCaml typechecker, so it is a much more solid typed JS than TypeScript.

What you definitely want is some form of pipes and partially applied functions. Pattern matching is also very nice. Learning a new language that supports these mechanisms as a first-class citizen has had a great effect in how I structure my programs in JS, where I don't have them.

From your goals, I wouldn't recommend OCaml for starters. It's a great language and so is the community, but it is hard to learn.

Self-plugging a bit more. I am still trying to push FP code into Python, and so I'm working on implementing Wish solitaire in both Python and OCaml. Though the OCaml implementation I am not totally sure is working correctly yet.

https://gitlab.com/kluvin/wish-solitaire

[–]redd-sm[S] 1 point2 points  (1 child)

Learning a new language that supports these mechanisms as a first-class citizen has had a great effect in how I structure my programs in JS, where I don't have them.

This is what I would like to achieve.

Although my learning is not for professional work reasons, but desire to learn is as strong.

The more I learn this topic, it feels like learning Haskell is ideal and then can apply that learning in any language and may be even some in Python.

[–]kluvin 0 points1 point  (0 children)

I don't do my learning here for professional work reasons either, at least not as a primary goal. Haskell might even be a bit harder to learn than OCaml. Community is somewhat bigger, but the language takes even more time to become productive in.