Recursive Call of the Current Function

DESCRIPTION:

Makes a recursive call to the current function, so that the definition of a recursive function is independent of its name.

USAGE:

Recall(...) 

REQUIRED ARGUMENTS:

...
the arguments that should be given to the recursive call.

VALUE:

Recall finds the definition of the function from which it is being called, and recursively calls that function with the arguments supplied to Recall.

DETAILS:

The recursion does not depend on the name of the function. The Recall function also makes it possible to define a recursive function inside of another function.

WARNING:

To execute a deeply recursive function you may need to increase options("expressions") above its default level of 256. If options("expressions") is not large enough you will see the message "Error: Expressions nested beyond limit (256)". Recall() uses one more frame and one more level of expression nesting than the direct recursive call of your function by name, so you may have to increase options("expressions") to allow for that.

SEE ALSO:

.

EXAMPLES:

# recursive factorial function 
fact <- function(x) if(x<=1) x else x * Recall(x-1) 
fact(x)