callcc
|
The call_cc function provides a mechanism for terminating a called function
prematurely. No matter where the called function is, in terms of recursion depth,
call_cc allows the called function to terminate prematurely and return to the
spot just after the call_cc invocation. In order to do this, call_cc creates an artifice called a "current continuation",
which is passed to the called function as an argument. The called function must have
one and only one argument, which is to be the current continuation created by call_cc The call_cc function passes the current continuation as an argument to
function. The current continuation is also a function with one argument which, when
invoked, resumes execution from the spot just after the call_cc invocation. Usage Use whenever you may need a call back function to a higher recursion level in a
program. Multiple call_cc functions can be invoked in the same program. Each
continuation will always call back to the call_cc which created it.
(call_cc aFunction) The value returned by the aFunction argument.
Expression:
Arguments
Name
Type
Description Argument: aFunction aFunction
A function, expecting a current continuation argument, which may terminate
prematurely by invoking the current continuation.
Returns:
Here are a number of links to Lambda coding examples which contain this instruction in various use cases.
Here are the links to the data types of the function arguments.
Lambda | Function |
Here are also a number of links to functions having arguments with any of these data types.
Analytic Information Server (AIS)AIS Component Systems
|