On May 10 (18:58 -0300), Mariano Suarez Alvarez wrote with possible deletions:
| [...]
| The same idea works in general: if E is some expression,
|
| E (foldr f1 b1 xs) (foldr f2 b2 xs)
| = let (a,b) = (foldr f1 b1 xs,foldr f2 b2 xs)
| in E a b
| = let (a,b) = (foldr f1 b1 xs,foldr f2 b2 xs)
| in E a b
| = let (a,b) = foldr (\x -> (f1 x # f2 x)) (b1,b2) xs
| in E a b
|
| This is useful, since usually list traversing functions can be writen
| using foldr. I remember reading about this somewhere...
I don't know if this is the reference you were trying to recall here,
but Andrew Gill, John Launchbury, and Simon Peyton-Jones used this
technique as a preprocessing step for subsequent deforestation in
their "A Shortcut to Deforestation" (FPCA `93) paper.
--Teggy
--
| Torsten Grust mailto:[EMAIL PROTECTED] |
| http://www.informatik.uni-konstanz.de/~grust/ |
| Database Research Group, University of Konstanz (Lake Constance/Germany) |