Hacker News new | ask | show | jobs
by kbr 2512 days ago
Hey! I attempted to make the code snippets use practical concepts, but they aren't very practical for use in actual JavaScript code — the reason being that JavaScript is not a functional language and doesn't have syntactic sugar for monads.

However, I chose JavaScript because I believe it's more familiar and widespread, and it can be easier to explain a foreign concept when it's done in a language that more people feel comfortable with.

1 comments

Interestingly for someone like me who has had the luxury of never having to read or write a line of JavaScript, it was all alien gobbledygook. Whatever that code was supposed to be doing was not clear to this C++ programmer.
Sorry about that haha, the style of programming in this guide is very different from C++, and it relies heavily on currying and lambda functions using next-generation JavaScript syntax. Nonetheless, I think it can offer a new perspective because JS is more comfortable than Haskell for most developers.
Oh I'm fine with all those concepts. C++ has anonymous functions, and I'm a Haskell programmer too. But whatever syntax JavaScript uses is not standard across other imperative languages.
My bad then, that's fair. JS has been deviating from C-style syntax and it really shows in this article haha