I am having problems with the question that follows: Write the recursive function again. Use that takes as argument the function f of one argument and a positive integer n. The result of repeatApply is a function of one argument, which applies f to this argument n times.
So for example, we would
repeatedlyApply (lambda x: x + 1.10) (100) ==> 110
You can assume that the following function is defined. You do not have to use it, but it can help in a pretty good solution.
def compose (f, g):
return lambda x: f (g (x))
So far i wrote this
def compose(f,g):
return lambda x: f(g(x))
def recApply(f,n):
for i in range(n):
return recApply(compose(f,f), n-1)
return f
I am wrong because using the above recApply (lambda x: x + 1.10) (100) example, I get 1124.
Help appreciate