2 ms·
Okay: 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 cour
by sramsay 12y ago
Okay: 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.