
hi I have a problem. Function A is a function that passes its input into B Function B is a function that does something once. How do I make it so function A is done multiple times without adding a third function? Ryan _________________________________________________________________ Who's friends with who and co-starred in what? http://www.searchgamesbox.com/celebrityseparation.shtml

On Dec 8, 2007 7:41 PM, Ryan Bloor
hi
I have a problem.
Function A is a function that passes its input into B Function B is a function that does something once.
What do you mean by that? B does something once. More details! (Type signatures at least will give us a good idea what is going on) Luke

On 8 Dec 2007, ryanbloor@hotmail.com wrote:
Function A is a function that passes its input into B Function B is a function that does something once.
How do I make it so function A is done multiple times without adding a third function?
By this, do you mean that you have functions f, g f :: a -> a g :: a -> b and you want b . f . f . f . ... . f where there are n applications of f? If so, then g . (!! n) . iterate f will do the trick. Alternatively, you can produce the infinite list, as in: map (^2) . iterate succ $ 0 -- [0,1,4,9,16,25,36,49,64,81 ... Jed
participants (3)
-
Jed Brown
-
Luke Palmer
-
Ryan Bloor