New ask Hacker News story: Ask HN: What do FP languages have that JavaScript doesn't?

Ask HN: What do FP languages have that JavaScript doesn't?
2 by muunbo | 2 comments on Hacker News.
Whenever I read a functional programming tutorial or course, it always sings the praises of how there's an amazing REPL you can use to experiment with your code, or it will teach how to map and reduce over sequences, or first-class functions, or currying. The problem for me is, all of these awesome features already exist in popular languages like JS and Python. Then there's the "purity" side of things. For e.g. tutorials for Haskell and Clojure say that "mutation and side effects are not allowed" which makes for a more predictable program. But in my experience, I can totally just re-define variables in the REPL and no one stops me. I don't even get a warning. So I'm not sure if I'm missing something, but so far it doesn't feel so different from writing fancy ES6 syntax. The last thing is "macros". This one seems to be actually unique to FP languages like Clojure, etc. But is this the only unique feature of FP languages? Genuinely curious, please help me clear up my understanding. I have so far been following some fun Clojure and Haskell tutorials and these languages are very fun/sleek/logical to write in. I am just wondering if I could accomplish the same in JS easily without learning whole new languages and ecosystems.

Comments

Popular posts from this blog

New ask Hacker News story: Tell HN: Equifax free credit report dark patterns

New ask Hacker News story: Ask HN: Why can't the US government run their own social media?