2 ms·
Would you mind copy-pasting some example code? Ideally something similar to what you'd write in Clojure and solves some real-world problem? (The more code you
by sillysaurus3 12y ago
Would you mind copy-pasting some example code? Ideally something similar to what you'd write in Clojure and solves some real-world problem? (The more code you can paste, the better.) I'm quite curious to see whether the claim is true about being able to write something approaching Clojure while solving real-world problems.
- erichmond 12y agoAgreed. We have both clojure and node services in production here and the use cases for each technology is quite different.
- sramsay 12y agoThe big Clojure use-case for me has been Java interop. Aside from that, I'm not sure I'd prefer it to node. Of course, I have no idea what your use-cases look like . . .
- sramsay 12y agoOkay: http://pastebin.com/r40TN3Ni http://pastebin.com/r40TN3Ni This is a small command-line program that I use to compute grades (I have larger stuff, of course, but this one is easy to follow). There are important differences between Clojure and Javascript (cum lo-dash and Immutable). Perhaps the most important overall difference is that Javascript is never mandating immutability -- you have to watch carefully (and I'm probably screwing it up a few times in that code). In fact, I just noticed a bad example of mutating state when I pasted it. :( I also use imperative constructs from time to time, but I like that I can. I originally wrote this code using JS's object system. I absolutely hated it (and I do understand prototypal inheritance quite well). What's more important to me, is that actually writing the code feels "lispy." In that code, you'll see all the classics (especially as you move down): each, map, range, zip, and compose (my favorite). Lo-dash, of course, has many, many more.