
7 Oct
2005
7 Oct
'05
9:13 a.m.
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