/usr/share/doc/racket/syntax/varied-meanings.html is in racket-doc 6.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | <!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"/><title>1.2.4 Variants with Varied Meanings</title><link rel="stylesheet" type="text/css" href="../scribble.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="../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="../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">Syntax:<span class="mywbr"> </span> Meta-<wbr></wbr>Programming Helpers</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="stxparse.html" class="tocviewselflink" data-pltdoc="x">Parsing and Specifying Syntax</a></td></tr><tr><td align="right">2 </td><td><a href="syntax-helpers.html" class="tocviewlink" data-pltdoc="x">Syntax Object Helpers</a></td></tr><tr><td align="right">3 </td><td><a href="Datum_Pattern_Matching.html" class="tocviewlink" data-pltdoc="x">Datum Pattern Matching</a></td></tr><tr><td align="right">4 </td><td><a href="module-helpers.html" class="tocviewlink" data-pltdoc="x">Module-<wbr></wbr>Processing Helpers</a></td></tr><tr><td align="right">5 </td><td><a href="transformer-helpers.html" class="tocviewlink" data-pltdoc="x">Macro Transformer Helpers</a></td></tr><tr><td align="right">6 </td><td><a href="reader-helpers.html" class="tocviewlink" data-pltdoc="x">Reader Helpers</a></td></tr><tr><td align="right">7 </td><td><a href="Parsing_for_Bodies.html" class="tocviewlink" data-pltdoc="x">Parsing <span class="RktSym"><span class="RktStxLink">for</span></span> Bodies</a></td></tr><tr><td align="right">8 </td><td><a href="Unsafe_for_Clause_Transforms.html" class="tocviewlink" data-pltdoc="x">Unsafe <span class="RktSym"><span class="RktStxLink">for</span></span> Clause Transforms</a></td></tr><tr><td align="right">9 </td><td><a href="Source_Locations.html" class="tocviewlink" data-pltdoc="x">Source Locations</a></td></tr><tr><td align="right">10 </td><td><a href="Preserving_Source_Locations.html" class="tocviewlink" data-pltdoc="x">Preserving Source Locations</a></td></tr><tr><td align="right">11 </td><td><a href="toplevel.html" class="tocviewlink" data-pltdoc="x">Non-<wbr></wbr>Module Compilation And Expansion</a></td></tr><tr><td align="right">12 </td><td><a href="trusted-xforms.html" class="tocviewlink" data-pltdoc="x">Trusting Standard Recertifying Transformers</a></td></tr><tr><td align="right">13 </td><td><a href="docprovide.html" class="tocviewlink" data-pltdoc="x">Attaching Documentation to Exports</a></td></tr><tr><td align="right">14 </td><td><a href="wrapc.html" class="tocviewlink" data-pltdoc="x">Contracts for Macro Subexpressions</a></td></tr><tr><td align="right">15 </td><td><a href="macro-testing.html" class="tocviewlink" data-pltdoc="x">Macro Testing</a></td></tr><tr><td align="right">16 </td><td><a href="intdef.html" class="tocviewlink" data-pltdoc="x">Internal-<wbr></wbr>Definition Context Helpers</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">►</a></td><td>1 </td><td><a href="stxparse.html" class="tocviewlink" data-pltdoc="x">Parsing and Specifying Syntax</a></td></tr></table><div class="tocviewsublist" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.1 </td><td><a href="stxparse-intro.html" class="tocviewlink" data-pltdoc="x">Introduction</a></td></tr><tr><td align="right">1.2 </td><td><a href="stxparse-examples.html" class="tocviewselflink" data-pltdoc="x">Examples</a></td></tr><tr><td align="right">1.3 </td><td><a href="Parsing_Syntax.html" class="tocviewlink" data-pltdoc="x">Parsing Syntax</a></td></tr><tr><td align="right">1.4 </td><td><a href="stxparse-specifying.html" class="tocviewlink" data-pltdoc="x">Specifying Syntax with Syntax Classes</a></td></tr><tr><td align="right">1.5 </td><td><a href="stxparse-patterns.html" class="tocviewlink" data-pltdoc="x">Syntax Patterns</a></td></tr><tr><td align="right">1.6 </td><td><a href="Defining_Simple_Macros.html" class="tocviewlink" data-pltdoc="x">Defining Simple Macros</a></td></tr><tr><td align="right">1.7 </td><td><a href="Literal_Sets_and_Conventions.html" class="tocviewlink" data-pltdoc="x">Literal Sets and Conventions</a></td></tr><tr><td align="right">1.8 </td><td><a href="Library_Syntax_Classes_and_Literal_Sets.html" class="tocviewlink" data-pltdoc="x">Library Syntax Classes and Literal Sets</a></td></tr><tr><td align="right">1.9 </td><td><a href="Debugging_and_Inspection_Tools.html" class="tocviewlink" data-pltdoc="x">Debugging and Inspection Tools</a></td></tr><tr><td align="right">1.10 </td><td><a href="Experimental.html" class="tocviewlink" data-pltdoc="x">Experimental</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_2");">▼</a></td><td>1.2 </td><td><a href="stxparse-examples.html" class="tocviewlink" data-pltdoc="x">Examples</a></td></tr></table><div class="tocviewsublist" style="display: block;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.2.1 </td><td><a href="Phases_and_Reusable_Syntax_Classes.html" class="tocviewlink" data-pltdoc="x">Phases and Reusable Syntax Classes</a></td></tr><tr><td align="right">1.2.2 </td><td><a href="Optional_Keyword_Arguments.html" class="tocviewlink" data-pltdoc="x">Optional Keyword Arguments</a></td></tr><tr><td align="right">1.2.3 </td><td><a href="uniform-meanings.html" class="tocviewlink" data-pltdoc="x">Variants with Uniform Meanings</a></td></tr><tr><td align="right">1.2.4 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Variants with Varied Meanings</a></td></tr><tr><td align="right">1.2.5 </td><td><a href="More_Keyword_Arguments.html" class="tocviewlink" data-pltdoc="x">More Keyword Arguments</a></td></tr><tr><td align="right">1.2.6 </td><td><a href="exprc.html" class="tocviewlink" data-pltdoc="x">Contracts on Macro Sub-<wbr></wbr>expressions</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_3");">►</a></td><td>1.2.4 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Variants with Varied Meanings</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_3"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.2.4.1 </td><td><a href="#%28part._.Syntactic_.Normalization%29" class="tocviewlink" data-pltdoc="x">Syntactic Normalization</a></td></tr><tr><td align="right">1.2.4.2 </td><td><a href="#%28part._.Non-syntax-valued_.Attributes%29" class="tocviewlink" data-pltdoc="x">Non-<wbr></wbr>syntax-<wbr></wbr>valued Attributes</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">1.2.4.1<tt> </tt></span><a href="#%28part._.Syntactic_.Normalization%29" class="tocsubseclink" data-pltdoc="x">Syntactic Normalization</a></td></tr><tr><td><span class="tocsublinknumber">1.2.4.2<tt> </tt></span><a href="#%28part._.Non-syntax-valued_.Attributes%29" class="tocsubseclink" data-pltdoc="x">Non-<wbr></wbr>syntax-<wbr></wbr>valued Attributes</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="uniform-meanings.html" title="backward to "1.2.3 Variants with Uniform Meanings"" data-pltdoc="x">← prev</a> <a href="stxparse-examples.html" title="up to "1.2 Examples"" data-pltdoc="x">up</a> <a href="More_Keyword_Arguments.html" title="forward to "1.2.5 More Keyword Arguments"" data-pltdoc="x">next →</a></span> </div><h5 x-source-module="(lib "syntax/scribblings/syntax.scrbl")" x-source-pkg="racket-doc" x-part-tag=""varied-meanings"">1.2.4<tt> </tt><a name="(part._varied-meanings)"></a>Variants with Varied Meanings</h5><p>As explained in the <a href="uniform-meanings.html" data-pltdoc="x">previous section</a>,
the meaning of a syntax class can be uniform, or it can be varied;
that is, different instances of the syntax class can carry different
kinds of information. This section discusses the latter kind of syntax
class.</p><p>A good example of a syntax class with varied meanings is the
<span class="RktSym">for-clause</span> of the <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=for.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._for%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">for</a></span> family of special forms.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">for-clause</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">[</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">seq-expr</span><span class="RktPn">]</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">seq-expr</span><span class="RktPn">]</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:when</span><span class="hspace"> </span><span class="RktVar">guard-expr</span></td></tr></table></p><p>The first two variants carry the same kind of information; both
consist of identifiers to bind and a sequence expression. The third
variant, however, means something totally different: a condition that
determines whether to continue the current iteration of the loop, plus
a change in scoping for subsequent <span class="RktSym">seq-expr</span>s. The information
of a <span class="RktSym">for-clause</span> must be represented in a way that a client
macro can do further case analysis to distinguish the “bind variables
from a sequence” case from the “skip or continue this iteration and
enter a new scope” case.</p><p>This section discusses two ways of representing varied kinds of
information.</p><h5 x-source-module="(lib "syntax/scribblings/syntax.scrbl")" x-source-pkg="racket-doc" x-part-tag=""Syntactic_Normalization"">1.2.4.1<tt> </tt><a name="(part._.Syntactic_.Normalization)"></a>Syntactic Normalization</h5><p>One approach is based on the observation that the syntactic variants
already constitute a representation of the information they carry. So
why not adapt that representation, removing redundancies and
eliminating simplifying the syntax to make subsequent re-parsing
trivial.</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="stxparse-specifying.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._define-splicing-syntax-class%29%29" class="RktStxLink" data-pltdoc="x">define-splicing-syntax-class</a></span><span class="hspace"> </span><span class="RktSym">for-clause</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:attributes</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">norm</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stxparse-specifying.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._pattern%29%29" class="RktStxLink" data-pltdoc="x">pattern</a></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">var:id</span><span class="hspace"> </span><span class="RktSym">seq:expr</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:with</span><span class="hspace"> </span><span class="RktSym">norm</span><span class="hspace"> </span><span class="RktRdr">#'</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">var</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">seq</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="stxparse-specifying.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._pattern%29%29" class="RktStxLink" data-pltdoc="x">pattern</a></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">var:id</span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">seq:expr</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:with</span><span class="hspace"> </span><span class="RktSym">norm</span><span class="hspace"> </span><span class="RktRdr">#'</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">var</span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">seq</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="stxparse-specifying.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._pattern%29%29" class="RktStxLink" data-pltdoc="x">pattern</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stxparse-patterns.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7eseq%29%29" class="RktStxLink" data-pltdoc="x">~seq</a></span><span class="hspace"> </span><span class="RktPn">#:when</span><span class="hspace"> </span><span class="RktSym">guard:expr</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:with</span><span class="hspace"> </span><span class="RktSym">norm</span><span class="hspace"> </span><span class="RktRdr">#'</span><span class="RktPn">[</span><span class="RktPn">#:when</span><span class="hspace"> </span><span class="RktSym">guard</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>First, note that since the <span class="RktPn">#:when</span> variant consists of two
separate terms, we define <span class="RktSym">for-clause</span> as a splicing syntax
class. Second, that kind of irregularity is just the sort of thing
we’d like to remove so we don’t have to deal with it again later. Thus
we represent the normalized syntax as a single term beginning with
either a sequence of identifiers (the first two cases) or the keyword
<span class="RktPn">#:when</span> (the third case). The two normalized cases are easy to
process and easy to tell apart. We have also taken the opportunity to
desugar the first case into the second.</p><p>A normalized syntactic representation is most useful when the
subsequent case analysis is performed by <span class="RktSym"><a href="Parsing_Syntax.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._syntax-parse%29%29" class="RktStxLink" data-pltdoc="x">syntax-parse</a></span> or a
similar form.</p><h5 x-source-module="(lib "syntax/scribblings/syntax.scrbl")" x-source-pkg="racket-doc" x-part-tag=""Non-syntax-valued_Attributes"">1.2.4.2<tt> </tt><a name="(part._.Non-syntax-valued_.Attributes)"></a>Non-syntax-valued Attributes</h5><p>When the information carried by the syntax is destined for complicated
processing by Racket code, it is often better to parse it into an
intermediate representation using idiomatic Racket data structures,
such as lists, hashes, structs, and even objects.</p><p>Thus far we have only used syntax pattern variables and the
<span class="RktPn">#:with</span> keyword to bind attribues, and the values of the
attributes have always been syntax. To bind attributes to values other
than syntax, use the <span class="RktPn">#:attr</span> keyword.</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">A ForClause is either</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt"> - (bind-clause (listof identifier) syntax)</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt"> - (when-clause syntax)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span><span class="hspace"> </span><span class="RktSym">bind-clause</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">vars</span><span class="hspace"> </span><span class="RktSym">seq-expr</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=define-struct.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._struct%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">struct</a></span><span class="hspace"> </span><span class="RktSym">when-clause</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">guard</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="stxparse-specifying.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._define-splicing-syntax-class%29%29" class="RktStxLink" data-pltdoc="x">define-splicing-syntax-class</a></span><span class="hspace"> </span><span class="RktSym">for-clause</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:attributes</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">ast</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stxparse-specifying.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._pattern%29%29" class="RktStxLink" data-pltdoc="x">pattern</a></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">var:id</span><span class="hspace"> </span><span class="RktSym">seq:expr</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:attr</span><span class="hspace"> </span><span class="RktSym">ast</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">bind-clause</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktRdr">#'</span><span class="RktSym">var</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktRdr">#'</span><span class="RktSym">seq</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="stxparse-specifying.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._pattern%29%29" class="RktStxLink" data-pltdoc="x">pattern</a></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">var:id</span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">seq:expr</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:attr</span><span class="hspace"> </span><span class="RktSym">ast</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">bind-clause</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stxops.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._syntax-%7E3elist%2529%2529&version=6.7" class="RktValLink Sq" data-pltdoc="x">syntax->list</a></span><span class="hspace"> </span><span class="RktRdr">#'</span><span class="RktPn">(</span><span class="RktSym">var</span><span class="hspace"> </span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.7" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktRdr">#'</span><span class="RktSym">seq</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="stxparse-specifying.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._pattern%29%29" class="RktStxLink" data-pltdoc="x">pattern</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stxparse-patterns.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._~7eseq%29%29" class="RktStxLink" data-pltdoc="x">~seq</a></span><span class="hspace"> </span><span class="RktPn">#:when</span><span class="hspace"> </span><span class="RktSym">guard:expr</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:attr</span><span class="hspace"> </span><span class="RktSym">ast</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">when-clause</span><span class="hspace"> </span><span class="RktRdr">#'</span><span class="RktSym">guard</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>Be careful! If we had used <span class="RktPn">#:with</span> instead of <span class="RktPn">#:attr</span>,
a value produced by the right-hand side would be coerced to a syntax
object before being matched against the pattern <span class="RktSym">ast</span>.</p><p>Attributes with non-syntax values cannot be used in syntax
templates. Use the <span class="RktSym"><a href="stxparse-specifying.html#%28form._%28%28lib._syntax%2Fparse..rkt%29._attribute%29%29" class="RktStxLink" data-pltdoc="x">attribute</a></span> form to get the value of an
attribute.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="uniform-meanings.html" title="backward to "1.2.3 Variants with Uniform Meanings"" data-pltdoc="x">← prev</a> <a href="stxparse-examples.html" title="up to "1.2 Examples"" data-pltdoc="x">up</a> <a href="More_Keyword_Arguments.html" title="forward to "1.2.5 More Keyword Arguments"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|