4 Sep 2015
Notes on Haskell Folds.
foldr
“It is best to think of foldr non-recursively as simultaneously replacing each (:) in a list by a given function, and [] by a given value.” – Programming in Haskell
foldl
“It is best to think of the behaviour of foldl in a non-recursive manner, in terms of a left associative operator ⊕ starting from a given value.” – Programming in Haskell
(((( z ⊕ x1 ) ⊕ x2 ) ... ⊕ xn
Links
- Haskell Wiki - Folds
- Wikipedia - Folds
- Programming in Haskell Slides - Chapter 7 Higher Order Functions