<html><head><metahttp-equiv="content-type"content="text/html; charset=utf-8"/><title>txexpr: Tagged X-expressions</title><linkrel="stylesheet"type="text/css"href="scribble.css"title="default"/><linkrel="stylesheet"type="text/css"href="racket.css"title="default"/><linkrel="stylesheet"type="text/css"href="manual-style.css"title="default"/><linkrel="stylesheet"type="text/css"href="manual-racket.css"title="default"/><scripttype="text/javascript"src="scribble-common.js"></script><scripttype="text/javascript"src="manual-racket.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><bodyid="scribble-racket-lang-org"><divclass="tocset"><divclass="tocview"><divclass="tocviewlist tocviewlisttopspace"><divclass="tocviewtitle"><tablecellspacing="0"cellpadding="0"><tr><tdstyle="width: 1em;"><ahref="javascript:void(0);"title="Expand/Collapse"class="tocviewtoggle"onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><ahref="index.html"class="tocviewselflink"data-pltdoc="x">txexpr:<spanclass="mywbr"> </span> Tagged X-<wbr></wbr>expressions</a></td></tr></table></div><divclass="tocviewsublistonly"style="display: none;"id="tocview_0"><tablecellspacing="0"cellpadding="0"><tr><tdalign="right">1 </td><td><ahref="index.html#%28part._.Installation%29"class="tocviewlink"data-pltdoc="x">Installation</a></td></tr><tr><tdalign="right">2 </td><td><ahref="index.html#%28part._.Importing_the_module%29"class="tocviewlink"data-pltdoc="x">Importing the module</a></td></tr><tr><tdalign="right">3 </td><td><ahref="index.html#%28part._.What_s_a_txexpr_%29"class="tocviewlink"data-pltdoc="x">What’s a txexpr?</a></td></tr><tr><tdalign="right">4 </td><td><ahref="index.html#%28part._.Why_not_just_use_match__quasiquote__and_so_on_%29"class="tocviewlink"data-pltdoc="x">Why not just use <spanclass="stt">match</span>, <spanclass="stt">quasiquote</span>, and so on?</a></td></tr><tr><tdalign="right">5 </td><td><ahref="index.html#%28part._.Interface%29"class="tocviewlink"data-pltdoc="x">Interface</a></td></tr><tr><tdalign="right">6 </td><td><ahref="index.html#%28part._.License___source_code%29"class="tocviewlink"data-pltdoc="x">License & source code</a></td></tr></table></div></div></div><divclass="tocsub"><tableclass="tocsublist"cellspacing="0"><tr><td><spanclass="tocsublinknumber"></span><ahref="#%28part._txexpr__.Tagged_.X-expressions%29"class="tocsubseclink"data-pltdoc="x">txexpr:<spanclass="mywbr"> </span> Tagged X-<wbr></wbr>expressions</a></td></tr><tr><td><spanclass="tocsublinknumber">1<tt> </tt></span><ahref="#%28part._.Installation%29"class="tocsubseclink"data-pltdoc="x">Installation</a></td></tr><tr><td><spanclass="tocsublinknumber">2<tt> </tt></span><ahref="#%28part._.Importing_the_module%29"class="tocsubseclink"data-pltdoc="x">Importing the module</a></td></tr><tr><td><spanclass="tocsublinknumber">3<tt> </tt></span><ahref="#%28part._.What_s_a_txexpr_%29"class="tocsubseclink"data-pltdoc="x">What’s a txexpr?</a></td></tr><tr><td><spanclass="tocsublinknumber">4<tt> </tt></span><ahref="#%28part._.Why_not_just_use_match__quasiquote__and_so_on_%29"class="tocsubseclink"data-pltdoc="x">Why not just use <spanclass="stt">match</span>, <spanclass="stt">quasiquote</span>, and so on?</a></td></tr><tr><td><spanclass="tocsublinknumber">5<tt> </tt></span><ahref="#%28part._.Interface%29"class="tocsubseclink"data-pltdoc="x">Interface</a></td></tr><tr><td><ahref="#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr~3f%29%29"class="tocsubnonseclink"data-pltdoc="x"><spanclass="RktSym"><spanclass="RktValLink">txexpr?</span></span></a></td></tr><tr><td><ahref="#%28def._%28%28lib._txexpr%2Fmain..rkt%29._txexpr-tag~3f%29%29"class="tocsubnonseclink"data-pltdoc="x"><spanclass="RktSym"><spanclass="RktValLink">txexpr-<wbr></wbr>tag?</span></span></a></td></tr><tr><td><ahref="#%28def._%28%28lib._txexpr%2Fmain..rkt%29._
</div><divclass="SIntrapara"><tablecellspacing="0"><tr><td><p><spanclass="stt">raco pkg install txexpr</span></p></td></tr></table></div></p><p><divclass="SIntrapara">After that, you can update the package from the command line:
</div><divclass="SIntrapara"><tablecellspacing="0"><tr><td><p><spanclass="stt">raco pkg update txexpr</span></p></td></tr></table></div></p><h3>2<tt> </tt><aname="(part._.Importing_the_module)"></a>Importing the module</h3><p>The module operates in two modes: fast and safe. Fast mode is the default, which you get by importing the module in the usual way: <spanclass="RktPn">(</span><spanclass="RktSym"><ahref="http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29"class="RktStxLink"data-pltdoc="x">require</a></span><spanclass="RktMeta"></span><spanclass="hspace"> </span><spanclass="RktMeta"></span><spanclass="RktSym">txexpr</span><spanclass="RktPn">)</span><spanclass="RktMeta"></span>.</p><p>Safe mode enables the function contracts documented below. Use safe mode by importing the module as <spanclass="RktPn">(</span><spanclass="RktSym"><ahref="http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29"class="RktStxLink"data-pltdoc="x">require</a></span><spanclass="RktMeta"></span><spanclass="hspace"> </span><spanclass="RktMeta"></span><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="http://docs.racket-lang.org/reference/require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._submod%29%29"class="RktStxLink"data-pltdoc="x">submod</a></span><spanclass="RktMeta"></span><spanclass="hspace"> </span><spanclass="RktMeta"></span><spanclass="RktSym">txexpr</span><spanclass="RktMeta"></span><spanclass="hspace"> </span><spanclass="RktMeta"></span><spanclass="RktSym">safe</span><spanclass="RktPn">)</span><spanclass="RktPn">)</span><spanclass="RktMeta"></span>.</p><h3>3<tt> </tt><aname="(part._.What_s_a_txexpr_)"></a>What’s a txexpr?</h3><p>It’s an X-expression with the following grammar:</p><p><tablecellspacing="0"><tr><tdalign="right"valign="baseline"><spanclass="hspace"> </span><spanclass="RktVar">txexpr</span></td><tdalign="left"valign="baseline"><spanclass="stt"> </span></td><tdalign="center"valign="baseline">=</td><tdalign="left"valign="baseline"><spanclass="stt"> </span></td><tdalign="left"valign="baseline"><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29"class="RktValLink"data-pltdoc="x">list</a></span><spanclass="hspace"> </span><spanclass="RktVar">tag</span><spanclass="hspace"> </span><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29"class="RktValLink"data-pltdoc="x">list</a></span><spanclass="hspace"> </span><spanclass="RktVar">attr</span><spanclass="hspace"> </span><spanclass="RktSym">...</span><spanclass="RktPn">)</span><spanclass="hspace"> </span><spanclass="RktVar">element</span><spanclass="hspace"> </span><spanclass="RktSym">...</span><spanclass="RktPn">)</span></td></tr><tr><tdalign="right"valign="baseline"><spanclass="stt"> </span></td><tdalign="left"valign="baseline"><spanclass="stt"> </span></td><tdalign="center"valign="baseline">|</td><tdalign="left"valign="baseline"><spanclass="stt"> </span></td><tdalign="left"valign="baseline"><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29"class="RktValLink"data-pltdoc="x">cons</a></span><spanclass="hspace"> </span><spanclass="RktVar">tag</span><spanclass="hspace"> </span><spanclass="RktPn">(</span><spanclass="RktSym"><ahref="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29"class="RktValLink"data-pltdoc="x">list</a></span><spanclass="hspace"> </span><spanclass="RktVar">element</span><spanclass="hspace"> </span><spanclass="RktSym">...</span><spanclass="RktPn