
4 Apr
2014
4 Apr
'14
4:35 p.m.
There's a function named iterate in Prelude:
λ> :info iterate
iterate :: (a -> a) -> a -> [a] -- Defined in `GHC.List'
λ> take 8 (iterate (\x -> 2 * x + 1) 0)
[0,1,3,7,15,31,63,127]
On Fri, Apr 4, 2014 at 1:25 PM, John M. Dlugosz
What's a good way to produce an iterated function value sequence? That is, f(x), f(f(x)), f(f(f(x))), etc.
ref: https://www.youtube.com/watch?v=09JslnY7W_k
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners