[Haskell-cafe] folds with escapes

Claus Reinke claus.reinke at talk21.com
Thu Jul 5 04:58:02 EDT 2007

>> Can you do dropWhile in terms of foldr?  I don't see how.
> If you are really keen, you might want to try altering the "working  
> backwards with tuples" version into one which is properly lazy (many  
> people who read the paper pointed out the omission).

you might want to mention the story of the predecessor function in church 
numerals (where data structures are represented as their right folds, and 
the predecessor function goes against the grain of that recursion, but can
be defined using pairing/returning functions)? 

for some history/anecdotes:

    The Impact of the Lambda Calculus in Logic and Computer Science,
    Barendregt, Bulletin of Symbolic Logic, 1997, section 2, paragraph 2

for the tupling trick applied to dropWhile and primitive recursion, Graham's
tutorial has already been mentioned:

    A tutorial on the universality and expressiveness of fold
    Graham Hutton. Journal of Functional Programming, 1999, section 4


More information about the Haskell-Cafe mailing list