Pointless programming in JavaScript

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'), [...]
 •  0 comments  •  flag
Share on Twitter
Published on April 10, 2013 05:40
No comments have been added yet.