Yves Parès <yves.pares@gmail.com> wrote:
Note about []: Don't even mention foldl. The folding combinator for lists is foldr, period.
Yes, I do agree. I came to this when I realized foldr gave the church encoding of a list.
Not only that. The foldr combinator has an identity fold and implements actual structural recursion. The point is to give an idea what structural recursion means. I usually also introduce a custom tree type, again with a folding combinator.
(Well, actually, due to parameters ordering: *churchList list* z0 f = foldr f z0 list does)
Yes, the argument ordering of our foldr is a bit unfortunate. Greets, Ertugrul -- Key-ID: E5DD8D11 "Ertugrul Soeylemez <es@ertes.de>" FPrint: BD28 3E3F BE63 BADD 4157 9134 D56A 37FA E5DD 8D11 Keysrv: hkp://subkeys.pgp.net/