Javascript
COFFEESCRIPT IS A GATEWAY DRUG TO HASKELL
So, I've been working my way through _Learn You A Haskell For Great Good, _and in chapter five there's a quicksort example that reads:
quicksort [] = []
quicksort (x:xs) =
let smallerOrEqual = [a | a <- xs, a <= x]
larger = [a | a <- xs, a > x]
in quicksort smallerOrEqual ++ [x] ++ quicksort larger
I wondered what it would be like in Coffeescript. Frighteningly enough, other than moving the guard condition into the function itself, they look remarkably similar:
quicksort = (x) ->
return [] if x.length == 0
h = x.pop()
smallerOrEqual = (a for a in x when a <= h)
larger = (a for a in x when a > h)
(quicksort smallerOrEqual).concat([h]).concat(quicksort larger)
Coffescript is a gateway drug to Haskell. If you don't want to learn Haskell, turn back now. (On the other hand, I think learning Haskell will be a hell of a good thing for me. My brain needs the exercise.)