Haskell Folds

4 Sep 2015

Notes on Haskell Folds.

foldr

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

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

comments powered by Disqus

  « Previous: Next: »