// => map for (var i = 0; i < array.length; i++) { if (array[i]%2 == 0) doSomething(array[i]); } // => filter var sum = 0; for (var i = 0; i < array.length; i++) { sum += array[i]; } // => reduce/foldl http://notes-on-haskell.blogspot.co.uk/2007/02/whats-wrong-with-for-loop.html Sunday, 7 October 12
= function(value, name) { return value + " and " + name; } // but here's the monadic way to do it var mAddPerson = function(mv, name) { return bindToFunction(mv, function(value) { return makeMonadicValue(value + " and " + name); }) } Sunday, 7 October 12
real-world structures, and gives programmers a powerful way to simplify the design and construction of complex programs. - D. Gelernter, the 80s Sunday, 7 October 12