110 lines
83 KiB
HTML
110 lines
83 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=0.8"/><title>10.5 Continuation Marks</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="extras.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">The Racket Reference</a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="model.html" class="tocviewlink" data-pltdoc="x">Language Model</a></td></tr><tr><td align="right">2 </td><td><a href="notation.html" class="tocviewlink" data-pltdoc="x">Notation for Documentation</a></td></tr><tr><td align="right">3 </td><td><a href="syntax.html" class="tocviewlink" data-pltdoc="x">Syntactic Forms</a></td></tr><tr><td align="right">4 </td><td><a href="data.html" class="tocviewlink" data-pltdoc="x">Datatypes</a></td></tr><tr><td align="right">5 </td><td><a href="structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">6 </td><td><a href="mzlib_class.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">7 </td><td><a href="mzlib_unit.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">8 </td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">9 </td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">10 </td><td><a href="control.html" class="tocviewselflink" data-pltdoc="x">Control Flow</a></td></tr><tr><td align="right">11 </td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr><tr><td align="right">12 </td><td><a href="Macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">13 </td><td><a href="input-and-output.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">14 </td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Reflection and Security</a></td></tr><tr><td align="right">15 </td><td><a href="os.html" class="tocviewlink" data-pltdoc="x">Operating System</a></td></tr><tr><td align="right">16 </td><td><a href="memory.html" class="tocviewlink" data-pltdoc="x">Memory Management</a></td></tr><tr><td align="right">17 </td><td><a href="unsafe.html" class="tocviewlink" data-pltdoc="x">Unsafe Operations</a></td></tr><tr><td align="right">18 </td><td><a href="running.html" class
|
||
|
general information about continuation marks.</p><p>The list of continuation marks for a key <span class="RktVar">k</span> and a continuation
|
||
|
<span class="RktVar">C</span> that extends <span class="RktVar">C<span style="vertical-align: sub; font-size: 80%">0</span></span> is defined as follows:</p><ul><li><p>If <span class="RktVar">C</span> is an empty continuation, then the mark list is
|
||
|
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._null%29%29" class="RktValLink" data-pltdoc="x">null</a></span>.</p></li><li><p>If <span class="RktVar">C</span>’s first frame contains a mark <span class="RktVar">m</span> for <span class="RktVar">k</span>,
|
||
|
then the mark list for <span class="RktVar">C</span> is <span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="stt"> </span><span class="RktVar">m</span><span class="stt"> </span><span class="RktVar">lst</span><span class="RktPn">)</span>,
|
||
|
where <span class="RktVar">lst</span> is the mark list for <span class="RktVar">k</span> in <span class="RktVar">C<span style="vertical-align: sub; font-size: 80%">0</span></span>.</p></li><li><p>If <span class="RktVar">C</span>’s first frame does not contain a mark keyed by
|
||
|
<span class="RktVar">k</span>, then the mark list for <span class="RktVar">C</span> is the mark list for
|
||
|
<span class="RktVar">C<span style="vertical-align: sub; font-size: 80%">0</span></span>.</p></li></ul><p>The <span class="RktSym"><a href="wcm.html#%28form._%28%28quote._~23~25kernel%29._with-continuation-mark%29%29" class="RktStxLink" data-pltdoc="x">with-continuation-mark</a></span> form installs a mark on the first
|
||
|
frame of the current continuation (see <a href="wcm.html" data-pltdoc="x">Continuation Marks: <span class="RktSym"><span class="RktStxLink">with-continuation-mark</span></span></a>). Procedures
|
||
|
such as <span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span> allow inspection of marks.</p><p>Whenever Racket creates an exception record for a primitive exception,
|
||
|
it fills the <span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-marks%29%29" class="RktValLink" data-pltdoc="x">continuation-marks</a></span> field with the value of
|
||
|
<span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span><span class="RktPn">)</span>, thus providing a snapshot of
|
||
|
the continuation marks at the time of the exception.</p><p>When a continuation procedure returned by
|
||
|
<span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._call-with-current-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-current-continuation</a></span> or
|
||
|
<span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._call-with-composable-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-composable-continuation</a></span> is invoked, it restores the
|
||
|
captured continuation, and also restores the marks in the
|
||
|
continuation’s frames to the marks that were present when
|
||
|
<span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._call-with-current-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-current-continuation</a></span> or
|
||
|
<span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._call-with-composable-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-composable-continuation</a></span> was invoked.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._continuation-marks))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-marks%29%29" class="RktValDef RktValLink" data-pltdoc="x">continuation-marks</a></span></span><span class="hspace"> </span><span class="RktVar">cont</span><span class="hspace"> </span><span class="RktOpt">[</span><span class="RktVar">prompt-tag</span><span class="RktOpt">]</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set~3f%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">cont</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._continuation~3f%29%29" class="RktValLink" data-pltdoc="x">continuation?</a></span><span class="hspace"> </span><span class="RktSym"><a href="threads.html#%28def._%28%28quote._~23~25kernel%29._thread~3f%29%29" class="RktValLink" data-pltdoc="x">thread?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">prompt-tag</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">:</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._continuation-prompt-tag~3f%29%29" class="RktValLink" data-pltdoc="x">continuation-prompt-tag?</a></span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">=</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktPn">(</span><span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._default-continuation-prompt-tag%29%29" class="RktValLink" data-pltdoc="x">default-continuation-prompt-tag</a></span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Returns an opaque value containing the set of continuation marks for
|
||
|
all keys in the continuation <span class="RktVar">cont</span> (or the current
|
||
|
continuation of <span class="RktVar">cont</span> if it is a thread) up to the prompt
|
||
|
tagged by <span class="RktVar">prompt-tag</span>. If <span class="RktVar">cont</span> is <span class="RktVal">#f</span>, the
|
||
|
resulting set of continuation marks is empty. If <span class="RktVar">cont</span> is an escape
|
||
|
continuation (see <a href="eval-model.html#%28part._prompt-model%29" data-pltdoc="x">Prompts, Delimited Continuations, and Barriers</a>), then the current
|
||
|
continuation must extend <span class="RktVar">cont</span>, or the
|
||
|
<span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail~3acontract%29%29" class="RktValLink" data-pltdoc="x">exn:fail:contract</a></span> exception is raised. If <span class="RktVar">cont</span> was not captured with
|
||
|
respect to <span class="RktVar">prompt-tag</span> and does not include a prompt for
|
||
|
<span class="RktVar">prompt-tag</span>, the <span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail~3acontract%29%29" class="RktValLink" data-pltdoc="x">exn:fail:contract</a></span> exception is raised. If
|
||
|
<span class="RktVar">cont</span> is a dead thread, the result is an empty set of
|
||
|
continuation marks.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._current-continuation-marks))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValDef RktValLink" data-pltdoc="x">current-continuation-marks</a></span></span><span class="hspace"> </span><span class="RktOpt">[</span><span class="RktVar">prompt-tag</span><span class="RktOpt">]</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set~3f%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set?</a></span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">prompt-tag</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">:</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._continuation-prompt-tag~3f%29%29" class="RktValLink" data-pltdoc="x">continuation-prompt-tag?</a></span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">=</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktPn">(</span><span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._default-continuation-prompt-tag%29%29" class="RktValLink" data-pltdoc="x">default-continuation-prompt-tag</a></span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Returns an opaque value containing the set of continuation marks for
|
||
|
all keys in the current continuation up to <span class="RktVar">prompt-tag</span>. In
|
||
|
other words, it produces the same value as</div></p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._call-with-current-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-current-continuation</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-marks%29%29" class="RktValLink" data-pltdoc="x">continuation-marks</a></span><span class="hspace"> </span><span class="RktSym">k</span><span class="hspace"> </span><span class="RktVar">prompt-tag</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">prompt-tag</span><span class="RktPn">)</span></td></tr></table></blockquote><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._continuation-mark-set-~3elist))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3elist%29%29" class="RktValDef RktValLink" data-pltdoc="x">continuation-mark-set->list</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">mark-set</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">key-v</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span><span class="RktOpt">[</span></td><td valign="top"><span class="RktVar">prompt-tag</span><span class="RktOpt">]</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._list~3f%29%29" class="RktValLink" data-pltdoc="x">list?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mark-set</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set~3f%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</spa
|
||
|
in <span class="RktVar">mark-set</span>, which is a set of marks returned by
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span> or <span class="RktVal">#f</span> as a shorthand for
|
||
|
<span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span><span class="stt"> </span><span class="RktVar">prompt-tag</span><span class="RktPn">)</span>. The result list is truncated at
|
||
|
the first point, if any, where continuation frames were originally
|
||
|
separated by a prompt tagged with <span class="RktVar">prompt-tag</span>. Producing the result
|
||
|
takes time proportional to the size of the continuation reflected by
|
||
|
<span class="RktVar">mark-set</span>.</div></p><p class="SHistory">Changed in version 8.0.0.1 of package <span class="stt">base</span>: Changed to allow <span class="RktVar">mark-set</span> as <span class="RktVal">#f</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._continuation-mark-set-~3elist*))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3elist%2A%29%29" class="RktValDef RktValLink" data-pltdoc="x">continuation-mark-set->list*</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">mark-set</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">key-list</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span><span class="RktOpt">[</span></td><td valign="top"><span class="RktVar">none-v</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">prompt-tag</span><span class="RktOpt">]</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="vectors.html#%28def._%28%28quote._~23~25kernel%29._vector~3f%29%29" class="RktValLink" data-pltdoc="x">vector?</a></span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mark-set</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set~3f%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">key-list</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href=
|
||
|
<span class="RktVar">mark-set</span> for the keys in <span class="RktVar">key-list</span>, up to
|
||
|
<span class="RktVar">prompt-tag</span>, where a <span class="RktVal">#f</span> value for <span class="RktVar">mark-set</span>
|
||
|
is equivalent to <span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span><span class="stt"> </span><span class="RktVar">prompt-tag</span><span class="RktPn">)</span>.
|
||
|
The length of each vector in the result list is
|
||
|
the same as the length of <span class="RktVar">key-list</span>, and a value in a
|
||
|
particular vector position is the value for the corresponding key in
|
||
|
<span class="RktVar">key-list</span>. Values for multiple keys appear in a single vector
|
||
|
only when the marks are for the same continuation frame in
|
||
|
<span class="RktVar">mark-set</span>. The <span class="RktVar">none-v</span> argument is used for vector
|
||
|
elements to indicate the lack of a value. Producing the result
|
||
|
takes time proportional to the size of the continuation reflected by
|
||
|
<span class="RktVar">mark-set</span> times the length of <span class="RktVar">key-list</span>.</div></p><p class="SHistory">Changed in version 8.0.0.1 of package <span class="stt">base</span>: Changed to allow <span class="RktVar">mark-set</span> as <span class="RktVal">#f</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._continuation-mark-set-~3eiterator))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3eiterator%29%29" class="RktValDef RktValLink" data-pltdoc="x">continuation-mark-set->iterator</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">mark-set</span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">key-list</span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span><span class="RktOpt">[</span></td><td valign="top"><span class="RktVar">none-v</span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">prompt-tag</span><span class="RktOpt">]</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="values.html#%28def._%28%28quote._~23~25kernel%29._values%29%29" class="RktValLink" data-pltdoc="x">values</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="vectors.html#%28def._%28%28quote._~23~25kernel%29._vector~3f%29%29" class="RktValLink" data-pltdoc="x">vector?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="procedures.html#%28def._%28%28quote._~23~25kernel%29._procedure~3f%29%29" class="RktValLink" data-pltdoc="x">procedure?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mark-set</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set~3f%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">key-list</span><span class
|
||
|
list of values, returns a functional iterator in the form of a
|
||
|
procedure that returns one element of the would-be list and a new
|
||
|
iterator function for the rest of the would-be list. An iterator
|
||
|
procedure returns <span class="RktVal">#f</span> instead of a vector when no more
|
||
|
elements are available; in that case, the returned iterator
|
||
|
procedure is like the called one, producing no further values.
|
||
|
The time required for each step is proportional to the length of
|
||
|
<span class="RktVar">key-list</span> times the size of the segment of the continuation
|
||
|
reflected by <span class="RktVar">mark-set</span> between frames that have keys in
|
||
|
<span class="RktVar">key-list</span>.</div></p><p class="SHistory">Added in version 7.5.0.7 of package <span class="stt">base</span>.<br/>Changed in version 8.0.0.1: Changed to allow <span class="RktVar">mark-set</span> as <span class="RktVal">#f</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._continuation-mark-set-first))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-first%29%29" class="RktValDef RktValLink" data-pltdoc="x">continuation-mark-set-first</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">mark-set</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">key-v</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span><span class="RktOpt">[</span></td><td valign="top"><span class="RktVar">none-v</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">prompt-tag</span><span class="RktOpt">]</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mark-set</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set~3f%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">key-v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">none-v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class=
|
||
|
<span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3elist%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set->list</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="if.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._or%29%29" class="RktStxLink" data-pltdoc="x">or</a></span><span class="stt"> </span><span class="RktVar">mark-set</span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span><span class="stt"> </span><span class="RktVar">prompt-tag</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="stt"> </span><span class="RktVar">key-v</span><span class="stt"> </span><span class="RktVar">prompt-tag</span><span class="RktPn">)</span>, or
|
||
|
<span class="RktVar">none-v</span> if the result would be the empty list.</div></p><p>The result
|
||
|
is produced in (amortized) constant time. Typically, this
|
||
|
result can be computed more quickly using
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-first%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set-first</a></span> than using
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3elist%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set->list</a></span> or by using
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3eiterator%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set->iterator</a></span> and iterating just once.</p><p>Although <span class="RktVal">#f</span> and <span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span><span class="stt"> </span><span class="RktVar">prompt-tag</span><span class="RktPn">)</span> are equivalent for <span class="RktVar">mark-set</span>, providing <span class="RktVal">#f</span>
|
||
|
as <span class="RktVar">mark-set</span> can enable shortcuts that make it even faster.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._call-with-immediate-continuation-mark))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._call-with-immediate-continuation-mark%29%29" class="RktValDef RktValLink" data-pltdoc="x">call-with-immediate-continuation-mark</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">key-v</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">proc</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span><span class="RktOpt">[</span></td><td valign="top"><span class="RktVar">default-v</span><span class="RktOpt">]</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">key-v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">proc</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">default-v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktVar">proc</span> with the value associated with <span class="RktVar">key-v</s
|
||
|
the first frame of the current continuation (i.e., a value that would
|
||
|
be replaced if the call to
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._call-with-immediate-continuation-mark%29%29" class="RktValLink" data-pltdoc="x">call-with-immediate-continuation-mark</a></span> were replaced with a
|
||
|
<span class="RktSym"><a href="wcm.html#%28form._%28%28quote._~23~25kernel%29._with-continuation-mark%29%29" class="RktStxLink" data-pltdoc="x">with-continuation-mark</a></span> form using <span class="RktVar">key-v</span> as the key
|
||
|
expression). If no such value exists in the first frame,
|
||
|
<span class="RktVar">default-v</span> is passed to <span class="RktVar">proc</span>. The <span class="RktVar">proc</span> is
|
||
|
called in tail position with respect to the
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._call-with-immediate-continuation-mark%29%29" class="RktValLink" data-pltdoc="x">call-with-immediate-continuation-mark</a></span> call.</div></p><p>This function could be implemented with a combination of
|
||
|
<span class="RktSym"><a href="wcm.html#%28form._%28%28quote._~23~25kernel%29._with-continuation-mark%29%29" class="RktStxLink" data-pltdoc="x">with-continuation-mark</a></span>, <span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span>,
|
||
|
and <span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3elist%2A%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set->list*</a></span>, as shown below, but
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._call-with-immediate-continuation-mark%29%29" class="RktValLink" data-pltdoc="x">call-with-immediate-continuation-mark</a></span> is implemented more
|
||
|
efficiently; it inspects only the first frame of the current
|
||
|
continuation.</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">Equivalent, but inefficient:</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._call-with-immediate-continuation-mark%29%29" class="RktValLink" data-pltdoc="x">call-with-immediate-continuation-mark</a></span><span class="hspace"> </span><span class="RktVar">key-v</span><span class="hspace"> </span><span class="RktVar">proc</span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktVar">default-v</span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">private-key</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._gensym%29%29" class="RktValLink" data-pltdoc="x">gensym</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="wcm.html#%28form._%28%28quote._~23~25kernel%29._with-continuation-mark%29%29" class="RktStxLink" data-pltdoc="x">with-continuation-mark</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">private-key</span><span class="hspace"> </span><span class="RktVal">#t</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">vecs</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3elist%2A%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set->list*</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29" class="RktValLink" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVar">key-v</span><span class="hspace"> </span><span class="RktSym">private-key</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">default-v</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><
|
||
|
of any other value (including prior and future results from
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._make-continuation-mark-key%29%29" class="RktValLink" data-pltdoc="x">make-continuation-mark-key</a></span>). The continuation mark key can be used
|
||
|
as the key argument for <span class="RktSym"><a href="wcm.html#%28form._%28%28quote._~23~25kernel%29._with-continuation-mark%29%29" class="RktStxLink" data-pltdoc="x">with-continuation-mark</a></span> or accessor procedures
|
||
|
like <span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-first%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set-first</a></span>. The mark key can be chaperoned
|
||
|
or impersonated, unlike other values that are used as the mark key.</div></p><p>The optional <span class="RktVar">sym</span> argument, if provided, is used when printing
|
||
|
the continuation mark.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._continuation-mark-key~3f))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-key~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">continuation-mark-key?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <span class="RktVar">v</span> is a mark key created by
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._make-continuation-mark-key%29%29" class="RktValLink" data-pltdoc="x">make-continuation-mark-key</a></span>, <span class="RktVal">#f</span> otherwise.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._continuation-mark-set~3f))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">continuation-mark-set?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <span class="RktVar">v</span> is a mark set created by
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-marks%29%29" class="RktValLink" data-pltdoc="x">continuation-marks</a></span> or <span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span>,
|
||
|
<span class="RktVal">#f</span> otherwise.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((quote._~23~25kernel)._continuation-mark-set-~3econtext))"></a><span title="Provided from: racket/base, racket | Package: base"><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3econtext%29%29" class="RktValDef RktValLink" data-pltdoc="x">continuation-mark-set->context</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">mark-set</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span><span class="RktOpt">[</span></td><td valign="top"><span class="RktVar">realms?</span><span class="RktOpt">]</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._list~3f%29%29" class="RktValLink" data-pltdoc="x">list?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mark-set</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set~3f%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">realms?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a list representing an approximate “<a name="(idx._(gentag._221._(lib._scribblings/reference/reference..scrbl)))"></a><a name="(idx._(gentag._222._(lib._scribblings/reference/reference..scrbl)))"></a>stack trace” for <span class="RktVar">mark-set</span>’s continuation.
|
||
|
The list contains pairs if <span class="RktVar">realms?</span> is <span class="RktVal">#f</span>, where the
|
||
|
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span> of each pair contains either <span class="RktVal">#f</span> or a symbol for
|
||
|
a procedure name, and the <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span> of each pair contains either
|
||
|
<span class="RktVal">#f</span> or a <span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._srcloc%29%29" class="RktValLink" data-pltdoc="x">srcloc</a></span> value for the procedure’s source
|
||
|
location (see <a href="linecol.html" data-pltdoc="x">Counting Positions, Lines, and Columns</a>); the <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span> and <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span>
|
||
|
are never both <span class="RktVal">#f</span>. If <span class="RktVar">realms?</span> is true, the list
|
||
|
contains 3-element vectors, where the first two elements are like the
|
||
|
values for a pair, and the third element is a realm symbol.</div></p><p>Conceptually, the stack-trace list is the result of
|
||
|
<span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3elist%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set->list</a></span> with <span class="RktVar">mark-set</span> and
|
||
|
Racket’s private key for procedure-call marks. The implementation may
|
||
|
be different, however, and the results may merely approximate the
|
||
|
correct answer. Thus, while the result may contain useful hints to
|
||
|
humans about the context of an expression, it is not reliable enough
|
||
|
for programmatic use.</p><p>A stack trace is extracted from an exception and displayed by the
|
||
|
default error display handler (see
|
||
|
<span class="RktSym"><a href="exns.html#%28def._%28%28quote._~23~25kernel%29._error-display-handler%29%29" class="RktValLink" data-pltdoc="x">error-display-handler</a></span>) for exceptions other than
|
||
|
<span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail~3auser%29%29" class="RktValLink" data-pltdoc="x">exn:fail:user</a></span> (see <span class="RktSym"><a href="exns.html#%28def._%28%28quote._~23~25kernel%29._raise-user-error%29%29" class="RktValLink" data-pltdoc="x">raise-user-error</a></span> in
|
||
|
<a href="exns.html#%28part._errorproc%29" data-pltdoc="x">Raising Exceptions</a>).</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">extract-current-continuation-marks</span><span class="hspace"> </span><span class="RktSym">key</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-~3elist%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set->list</a></span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktSym">key</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="wcm.html#%28form._%28%28quote._~23~25kernel%29._with-continuation-mark%29%29" class="RktStxLink" data-pltdoc="x">with-continuation-mark</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">key</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">mark</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">extract-current-continuation-marks</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">key</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">'(mark)</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="wcm.html#%28form._%28%28quote._~23~25kernel%29._with-continuation-mark%29%29" class="RktStxLink" data-pltdoc="x">with-continuation-mark</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">key1</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">mark1</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="wcm.html#%28form._%28%28quote._~23~25kernel%29._with-continuation-mark%29%29" class="RktStxLink" data-pltdoc="x">with-continuation-mark</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">key2</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">mark2</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29" class="RktValLink" data-pltdoc="x">list</a></span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">extract-current-continuation-marks</span><span class="hspace"> </span><span class="RktVal">'</span><span cl
|