# functions - Iterate and Curry

• Sep 14th 2011, 07:15 AM
sureshcisco
functions - Iterate and Curry
Folks, I am trying to refresh function...and could not solve a problem...can anyone help..

LetA be an arbitrary set. For any total function P: A à A and any non-negative integer n, iterate(P, n) isdefined as the n-th iteration of f, in other words, the function iterate(f,n)is defined as iterate(p, n) = p ; p ; ... ; p (n times of composition).The sign “;” is used for function composition.

Whatis the signature of iterate?
Whatis the signature of curry(iterate)?

Thanks.
• Sep 14th 2011, 08:14 AM
emakarov
Re: functions - Iterate and Curry
Quote:

Originally Posted by sureshcisco
For any total function P: A à A

Bonjour et bienvenue!

iterate : (A -> A) x nat -> (A -> A)

The function iterate takes a function and a number and returns a function. The right pair of parentheses is optional because -> associates to the right. (I would even say that iterate is polymorphic because it can probably work for any type A.)

curry(iterate) : (A -> A) -> nat -> (A -> A)

but this may depend on the precise definition of currying that you have.