Re: [Haskell-cafe] Working inside the fold

2005-10-07 Thread Christian Maeder
Greg Buchholz wrote: nats f unit = foldr f unit [1..] *Main nats (takeWhile_ [] (15) (:)) [] [1,2,3,4,5,6,7,8,9,10,11,12,13,14] ...That's a little bit ugly because you have to supply the unit value This could be solved by defining: nats f = foldr f undefined [1..] Christian

Re: [Haskell-cafe] Working inside the fold

2005-10-07 Thread Stefan Holdermans
Greg, map_ :: (a - b) - (b - c - d) - a - c - d map_ f g a b = g (f a) b Please note that map_ = flip (.) or, if you import Control.Arrow, map_ = () Regards, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Working inside the fold

2005-10-06 Thread Greg Buchholz
Recently I've been browsing some of Oleg Kiselyov's articles entitled Towards the best collection traversal interface... http://okmij.org/ftp/Computation/Continuations.html#enumerator-stream A programming language system gives us typically one of the two interfaces to