Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

At most JavaScript is an imperative language with functional flavour


Try LiveScript: http://livescript.net/

JS semantics are those of a functional-oop language. It lacks a few standard functions (LiveScript has prelude-ls) and a ton of syntactic support for things. Once these are in place, you can write the code which looks and feels like Ocaml.

For example, moment.js function is `moment(dateString, formatString)`. In LiveScript I used it as:

     parseDate = (flip moment) "DD/MM/YYYY"
Now tell me that this doesn't look like functional code :)

(The only really lacking feature in JS is of course TCO, but then Clojure, so yeah, let's just trampoline everything.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: