News for hackers. Stuff that matters.
Re:Scala school by danieldk on Tuesday September 20, 2011 @11:33AM (#3017945)
1. 'compose f g' doesn't call g and then f, but it constructs a new function of the form \x -> f (g x).

2. Maps store mappings between keys and values.

3. Left and right folds both process a list recursively from start to end. However, left folds apply the given function first and then recurse. Right folds recurse first and then apply. As a result, in right folds the given function is applied to the last element first.

Re:Scala school by fhars on Tuesday September 20, 2011 @01:18PM (#3018514)
Also, right folds preserve the structure of the datatype folded over. If you fold right over a list with the empty list as the start value and cons (or (_::_) in scala) as the operation, you get the original list back (i.e. same value, not same object). A left fold on the other hand is just some arbitrary looping constuct.