EVOLUTION-MANAGER
Edit File: callCC.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Call With Current Continuation</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for callCC {base}"><tr><td>callCC {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Call With Current Continuation</h2> <h3>Description</h3> <p>A downward-only version of Scheme's call with current continuation. </p> <h3>Usage</h3> <pre> callCC(fun) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>fun</code></td> <td> <p>function of one argument, the exit procedure.</p> </td></tr> </table> <h3>Details</h3> <p><code>callCC</code> provides a non-local exit mechanism that can be useful for early termination of a computation. <code>callCC</code> calls <code>fun</code> with one argument, an <em>exit function</em>. The exit function takes a single argument, the intended return value. If the body of <code>fun</code> calls the exit function then the call to <code>callCC</code> immediately returns, with the value supplied to the exit function as the value returned by <code>callCC</code>. </p> <h3>Author(s)</h3> <p>Luke Tierney</p> <h3>Examples</h3> <pre> # 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)) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>