
Yves Parès
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