Going Functional – Reduce

12 January 2013 by Tomas Brambora - Category: Technical Articles

Reduce (a.k.a. foldl) is one of my all-time favorite higher-order functions. It’s kinda sorta the crane stance of the functional style kung-fu: you don’t want to use it a lot but when you do it can save the day. Every now and then you come across an array and you want to combine its items somehow [...]


Going Functional: Map

7 January 2013 by Tomas Brambora - Category: Technical Articles

Let’s face it: the ‘map’ function (a.k.a. ‘apply-to-all’) is pretty simple. You just pass it an array and a function and it returns an array of results of that function applied to each item. What’s it all about then? Here comes the important bit: the new array will have the same size as the original one. Always. [...]