read


read
or learn more

Pointless programming in JavaScript

Apr 10, 2013 one comment

Using Underscore and Lemonad, how could you write a run-length encoder/decoder without ever referencing a function parameter? One way: var S = [‘a’, ‘a’, ‘a’, ‘a’, ‘b’, ‘c’, ‘c’, ‘a’, ‘a’, ‘d’, ‘e’, ‘e’, ‘e’, ‘e’]; var pack = L.partial1(L.partitionBy, _.identity); pack(S); //=> [[‘a’, ‘a’, ‘a’, ‘a’], [‘b’] …] var rle = _.compose( L.partial1(L.flip(_.map), L.juxt(L.plucker(‘length’), […]

Thrush in Clojure – Redux

Sep 28, 2010 some comments

Neither Clojure’s -> nor ->> are the Thrush combinator. See why.

Continue