\HeaderA{callCC}{Call With Current Continuation}{callCC}
\keyword{programming}{callCC}
\begin{Description}\relax
A downward-only version of Scheme's call with current continuation.
\end{Description}
\begin{Usage}
\begin{verbatim}
callCC(fun)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{fun}] function of one argument, the exit procedure.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{callCC} provides a non-local exit mechanism that can be useful
for early termination of a computation.  \code{callCC} calls
\code{fun} with one argument, an \emph{exit function}.  The exit
function takes a single argument, the intended return value.  If the
body of \code{fun} calls the exit function then the call to
\code{callCC} immediately returns, with the value supplied to the exit
function as the value returned by \code{callCC}.
\end{Details}
\begin{Author}\relax
Luke Tierney
\end{Author}
\begin{Examples}
\begin{ExampleCode}
# The following all return the value 1
callCC(function(k) 1)
callCC(function(k) k(1))
callCC(function(k) {k(1); 2})
callCC(function(k) repeat k(1))
\end{ExampleCode}
\end{Examples}

