I found a few ways to look at folds around the internet, and jotted them down here to have them in one place.

http://foldr.com/ 1+(…)=∞

http://foldl.com/ (…)+1=∞

Mnemonic: the associativity corresponds with where the initial element is tossed.

R -> 1 2 3 4 ... n z
L -> z 1 2 3 4 ... n

And any hopes for laziness happen away in foldr in left argument, away from buried initial element. i.e., initial element is buried.

Mnemonic: associativity corresponds with whether initial element is far left or far right, which corresponds with function taking initial/evolving value first or second).

images

  1. foldl f z

  2. foldr f z

references: