13 Oct
2007
13 Oct
'07
8:21 a.m.
Yes. Partially applied, (iterateN n) is a kind of iterate function, but (iterateN f) would be some kind of "function converting an integer into a function", which is much less useful. I would think that the number of iterations would usually depend on the function iterated, not the other way around. Maxime Henrion wrote:
Dan Weston wrote:
I like that name, and will henceforth use it myself until someone sees fit to add it to the Prelude!
Oh, and I guess we'd also need:
genericIterateN :: (a -> a) -> Integer -> a -> a
Which also got me thinking, wouldn't it make more sense to have the count as the first parameter?
iterateN :: Int -> (a -> a) -> a -> a genericIterateN :: Integer -> (a -> a) -> a -> a
Cheers, Maxime