loading...

re: Is JavaScript truly a functional language? VIEW POST

FULL DISCUSSION
 

The one thing I miss the most when using non-functional languages is pattern matching. It's everywhere in FP and makes life so easy. And along with that comes sum types that you can easily pattern match on. Sum types are basically enums but you can have some values of different types associated with the different choices.

Partial application. It's incredibly useful, especially when using higher-order functions like map. And it's used everywhere.

Forced immutability. It can help avoid so many pitfalls, and it doesn't let you fall back to using mutability if you don't know how to do it with immutability. The main problem I see with learning FP using a language like JS or Python is that you can easily fall back into their comfort zone if you don't know how to solve something. It also gets rid of those pesky global variables.

Haskell takes the functional aspect to the next level, but a lot of it isn't shared with most other functional languages. Like monads and other category theory things. If you are looking to learn a true functional language I would recommend F# or Clojure. Haskell is also a good alternative but it has a very steep learning curve.

Code of Conduct Report abuse