> If I haven’t used fold-left or fold-right in a while, I sometimes forget which one computes what.<p>I'm glad I'm not the only one struggling with this! Though I have started remembering it a different way: I pretend the 'r' in 'foldr' stands for recursive. Thus it's easier to remember that<p><pre><code> foldr(º, [a, b, ...]) ~=
a º (b º ...)
</code></pre>
where the right term for each operator is given by the recursive call. In contrast, then, foldl must be the iterative variant where<p><pre><code> foldl(º, z, [a, b, ...]) ~=
z º= a
z º= b
...
return z</code></pre>