You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sugar/doc/Coercion.html

3 lines
87 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"/><title>2&nbsp;Coercion</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"/><script type="text/javascript" src="scribble-common.js"></script><script type="text/javascript" src="manual-racket.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="scribble-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,&quot;tocview_0&quot;);">&#9660;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Sugar:<span class="mywbr"> &nbsp;</span> readability &amp; convenience library</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="Installation___updates.html" class="tocviewlink" data-pltdoc="x">Installation &amp; updates</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="Coercion.html" class="tocviewselflink" data-pltdoc="x">Coercion</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="Container.html" class="tocviewlink" data-pltdoc="x">Container</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="Debug.html" class="tocviewlink" data-pltdoc="x">Debug</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="File.html" class="tocviewlink" data-pltdoc="x">File</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="Len.html" class="tocviewlink" data-pltdoc="x">Len</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="License___source_code.html" class="tocviewlink" data-pltdoc="x">License &amp; source code</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,&quot;tocview_1&quot;);">&#9658;</a></td><td>2&nbsp;</td><td><a href="Coercion.html" class="tocviewselflink" data-pltdoc="x">Coercion</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">2.1&nbsp;</td><td><a href="Coercion.html#%28part._.Values%29" class="tocviewlink" data-pltdoc="x">Values</a></td></tr><tr><td align="right">2.2&nbsp;</td><td><a href="Coercion.html#%28part._.Coercion_contracts%29" class="tocviewlink" data-pltdoc="x">Coercion contracts</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">2.1<tt>&nbsp;</tt></span><a href="#%28part._.Values%29" class="tocsubseclink" data-pltdoc="x">Values</a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink"><span class="nobreak">-<wbr></wbr>&gt;</span>int</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3estring%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink"><span class="nobreak">-<wbr></wbr>&gt;</span>string</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3esymbol%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink"><span class="nobreak">-<wbr></wbr>&gt;</span>symbol</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3epath%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink"><span class="nobreak">-<wbr></wbr>&gt;</span>path</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3ecomplete-path%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink"><span class="nobreak">-<wbr></wbr>&gt;</span>complete-<wbr></wbr>path</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3elist%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink"><span class="nobreak">-<wbr></wbr>&gt;</span>list</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3evector%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink"><span class="nobreak">-<wbr></wbr>&gt;</span>vector</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eboolean%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink"><span class="nobreak">-<wbr></wbr>&gt;</span>boolean</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._intish~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">intish?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._stringish~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">stringish?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._symbolish~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">symbolish?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._pathish~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">pathish?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._complete-pathish~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">complete-<wbr></wbr>pathish?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._listish~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">listish?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._vectorish~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">vectorish?</span></span></a></td></tr><tr><td><span class="tocsublinknumber">2.2<tt>&nbsp;</tt></span><a href="#%28part._.Coercion_contracts%29" class="tocsubseclink" data-pltdoc="x">Coercion contracts</a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fint~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">coerce/<span class="mywbr"> &nbsp;</span>int?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fstring~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">coerce/<span class="mywbr"> &nbsp;</span>string?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fsymbol~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">coerce/<span class="mywbr"> &nbsp;</span>symbol?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fpath~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">coerce/<span class="mywbr"> &nbsp;</span>path?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fboolean~3f%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">coerce/<span class="mywbr"> &nbsp;</span>boolean?</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="versionbox"><span class="version">6.0.1.13</span></div><div class="navsettop"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="Installation___updates.html" title="backward to &quot;1 Installation &amp; updates&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Sugar: readability &amp; convenience library&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="Container.html" title="forward to &quot;3 Container&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h3>2<tt>&nbsp;</tt><a name="(part._.Coercion)"></a><a name="(mod-path._sugar/coerce)"></a>Coercion</h3><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="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><span class="stt"> </span><a href="Coercion.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">sugar/coerce</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">sugar</span></span></td></tr></table></p><p>Functions that coerce the datatype of a value to another type. Racket already has type-specific conversion functions. But if you&rsquo;re handling values of indeterminate type &#8212; as sometimes happens in an untyped language &#8212;&#160;then handling the possible cases individually gets to be a drag.</p><h4>2.1<tt>&nbsp;</tt><a name="(part._.Values)"></a>Values</h4><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._((lib._sugar/coerce..rkt)._-~3eint))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValDef RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">Convert <span class="RktVar">v</span> to an integer in the least surprising way, or raise an error if no conversion is possible.</div></p><p>Numbers are rounded down to the nearest integer.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktVal">3.5</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktVal"><span class="nobreak">-2</span>.5</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">-3</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2F%29%29" class="RktValLink" data-pltdoc="x">/</a></span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr></table></blockquote></td></tr></table></p><p>Stringlike values &#8212; paths, symbols, and strings &#8212; are converted to numbers and rounded down.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"3.5"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">3.5</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._string-~3epath%29%29" class="RktValLink" data-pltdoc="x">string-&gt;path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"3.5"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr></table></blockquote></td></tr></table></p><p>Characters are directly converted to integers.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">65</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#\&#9674;</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">9674</span></p></td></tr></table></blockquote></td></tr></table></p><p>Lists, vectors, and other multi-value datatypes return their length (using <span class="RktSym"><a href="Len.html#%28def._%28%28lib._sugar%2Flen..rkt%29._len%29%29" class="RktValLink" data-pltdoc="x">len</a></span>).</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="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><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="hspace">&nbsp;</span><span class="RktVal">6</span><span class="hspace">&nbsp;</span><span class="RktVal">7</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/hashtables.html#%28def._%28%28quote._~23~25kernel%29._hash%29%29" class="RktValLink" data-pltdoc="x">hash</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">a</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">b</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">c</span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr></table></blockquote></td></tr></table></p><p><div class="SIntrapara">The function will raise an error if no sensible conversion is possible.
</div><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Example:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eint%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>int</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">Can&#8217;t convert #t to integer</span></p></td></tr></table></blockquote></td></tr></table></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._((lib._sugar/coerce..rkt)._-~3estring))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3estring%29%29" class="RktValDef RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>string</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">Return the most natural string representation of <span class="RktVar">v</span>, or raise an error if none exists.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3estring%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>string</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"string"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"string"</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3estring%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>string</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">symbol</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"symbol"</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3estring%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>string</a></span><span class="hspace">&nbsp;</span><span class="RktVal">98.6</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"98.6"</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3estring%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>string</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._string-~3epath%29%29" class="RktValLink" data-pltdoc="x">string-&gt;path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"stdio.h"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"stdio.h"</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3estring%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>string</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"A"</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3estring%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>string</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">Can&#8217;t convert #t to string</span></p></td></tr></table></blockquote></td></tr></table></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._((lib._sugar/coerce..rkt)._-~3esymbol))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3esymbol%29%29" class="RktValDef RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>symbol</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">Same as <span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3estring%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>string</a></span>, but return a symbol rather than a string.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3esymbol%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>symbol</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"string"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'string</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3esymbol%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>symbol</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">symbol</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'symbol</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3esymbol%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>symbol</a></span><span class="hspace">&nbsp;</span><span class="RktVal">98.6</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'|98.6|</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3esymbol%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>symbol</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._string-~3epath%29%29" class="RktValLink" data-pltdoc="x">string-&gt;path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"stdio.h"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'stdio.h</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3esymbol%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>symbol</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'A</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3esymbol%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>symbol</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">Can&#8217;t convert #t to symbol</span></p></td></tr></table></blockquote></td></tr></table></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._-~3epath))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3epath%29%29" class="RktValDef RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>path</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._path~3f%29%29" class="RktValLink" data-pltdoc="x">path?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._-~3ecomplete-path))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3ecomplete-path%29%29" class="RktValDef RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>complete-path</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._complete-path~3f%29%29" class="RktValLink" data-pltdoc="x">complete-path?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr></table></blockquote></div><div class="SIntrapara">Same as <span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3estring%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>string</a></span>, but return a path (or complete path) rather than a string.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3epath%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"string"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#&lt;path:string&gt;</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3epath%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">symbol</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#&lt;path:symbol&gt;</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3ecomplete-path%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>complete-path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">98.6</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#&lt;path:/Users/MB/git/sugar/98.6&gt;</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3ecomplete-path%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>complete-path</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._string-~3epath%29%29" class="RktValLink" data-pltdoc="x">string-&gt;path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"stdio.h"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#&lt;path:/Users/MB/git/sugar/stdio.h&gt;</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3ecomplete-path%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>complete-path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#&lt;path:/Users/MB/git/sugar/A&gt;</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3ecomplete-path%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>complete-path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">Can&#8217;t convert #t to complete-path</span></p></td></tr></table></blockquote></td></tr></table></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._((lib._sugar/coerce..rkt)._-~3elist))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3elist%29%29" class="RktValDef RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>list</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._list~3f%29%29" class="RktValLink" data-pltdoc="x">list?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">If <span class="RktVar">v</span> is a listlike data type &#8212;&#160;a vector, set, stream, sequence, or list &#8212; convert it to a list. A hash or dictionary becomes a list using <span class="RktSym"><a href="http://docs.racket-lang.org/reference/dicts.html#%28def._%28%28lib._racket%2Fdict..rkt%29._dict-~3elist%29%29" class="RktValLink" data-pltdoc="x">dict-&gt;list</a></span>. If <span class="RktVar">v</span> is an atomic value, turn it into a single-member list.</div></p><p>Note that a string is treated as an atomic value rather than decomposed with <span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string-~3elist%29%29" class="RktValLink" data-pltdoc="x">string-&gt;list</a></span>. This is done so the function handles strings the same way as symbols and paths.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3elist%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>list</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">a</span><span class="hspace">&nbsp;</span><span class="RktVal">b</span><span class="hspace">&nbsp;</span><span class="RktVal">c</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(a b c)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3elist%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>list</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/vectors.html#%28def._%28%28quote._~23~25kernel%29._list-~3evector%29%29" class="RktValLink" data-pltdoc="x">list-&gt;vector</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">a</span><span class="hspace">&nbsp;</span><span class="RktVal">b</span><span class="hspace">&nbsp;</span><span class="RktVal">c</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(a b c)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3elist%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>list</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/hashtables.html#%28def._%28%28quote._~23~25kernel%29._make-hash%29%29" class="RktValLink" data-pltdoc="x">make-hash</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">(</span><span class="RktVal">k</span><span class="hspace">&nbsp;</span><span class="RktVal">. </span><span class="RktVal">v</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">k2</span><span class="hspace">&nbsp;</span><span class="RktVal">. </span><span class="RktVal">v2</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'((k . v) (k2 . v2))</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3elist%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>list</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"string"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'("string")</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3elist%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>list</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">symbol</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(symbol)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3elist%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>list</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._string-~3epath%29%29" class="RktValLink" data-pltdoc="x">string-&gt;path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"path"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(#&lt;path:path&gt;)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3elist%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>list</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(#&lt;procedure:+&gt;)</span></p></td></tr></table></blockquote></td></tr></table></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._((lib._sugar/coerce..rkt)._-~3evector))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3evector%29%29" class="RktValDef RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>vector</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/vectors.html#%28def._%28%28quote._~23~25kernel%29._vector~3f%29%29" class="RktValLink" data-pltdoc="x">vector?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">Same as <span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3elist%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>list</a></span>, but returns a vector rather than a list.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3evector%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>vector</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">a</span><span class="hspace">&nbsp;</span><span class="RktVal">b</span><span class="hspace">&nbsp;</span><span class="RktVal">c</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'#(a b c)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3evector%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>vector</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/vectors.html#%28def._%28%28quote._~23~25kernel%29._list-~3evector%29%29" class="RktValLink" data-pltdoc="x">list-&gt;vector</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">a</span><span class="hspace">&nbsp;</span><span class="RktVal">b</span><span class="hspace">&nbsp;</span><span class="RktVal">c</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'#(a b c)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3evector%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>vector</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/hashtables.html#%28def._%28%28quote._~23~25kernel%29._make-hash%29%29" class="RktValLink" data-pltdoc="x">make-hash</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">(</span><span class="RktVal">k</span><span class="hspace">&nbsp;</span><span class="RktVal">. </span><span class="RktVal">v</span><span class="RktVal">)</span><span class="hspace">&nbsp;</span><span class="RktVal">(</span><span class="RktVal">k2</span><span class="hspace">&nbsp;</span><span class="RktVal">. </span><span class="RktVal">v2</span><span class="RktVal">)</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'#((k . v) (k2 . v2))</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3evector%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>vector</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"string"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'#("string")</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3evector%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>vector</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">symbol</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'#(symbol)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3evector%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>vector</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._string-~3epath%29%29" class="RktValLink" data-pltdoc="x">string-&gt;path</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"path"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'#(#&lt;path:path&gt;)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3evector%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>vector</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'#(#&lt;procedure:+&gt;)</span></p></td></tr></table></blockquote></td></tr></table></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._((lib._sugar/coerce..rkt)._-~3eboolean))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eboolean%29%29" class="RktValDef RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>boolean</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">Return <span class="RktVal">#t</span> for all <span class="RktVar">v</span> except <span class="RktVal">#f</span>, which remains <span class="RktVal">#f</span>.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eboolean%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>boolean</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"string"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eboolean%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>boolean</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">symbol</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eboolean%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>boolean</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eboolean%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>boolean</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">l</span><span class="hspace">&nbsp;</span><span class="RktVal">i</span><span class="hspace">&nbsp;</span><span class="RktVal">s</span><span class="hspace">&nbsp;</span><span class="RktVal">t</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._-~3eboolean%29%29" class="RktValLink" data-pltdoc="x"><span class="nobreak">-&gt;</span>boolean</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr></table></blockquote></td></tr></table></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._intish~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._intish~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">intish?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._stringish~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._stringish~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">stringish?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._symbolish~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._symbolish~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">symbolish?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._pathish~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._pathish~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">pathish?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._complete-pathish~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._complete-pathish~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">complete-pathish?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._listish~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._listish~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">listish?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._vectorish~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._vectorish~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">vectorish?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr></table></blockquote></div><div class="SIntrapara">Predicates that report whether <span class="RktVar">v</span> can be coerced to the specified type.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" class="RktValLink" data-pltdoc="x">map</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._intish~3f%29%29" class="RktValLink" data-pltdoc="x">intish?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="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><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="hspace">&nbsp;</span><span class="RktVal">3.5</span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="hspace">&nbsp;</span><span class="RktVal">"A"</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(#t #t #t #f #f #f)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" class="RktValLink" data-pltdoc="x">map</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._stringish~3f%29%29" class="RktValLink" data-pltdoc="x">stringish?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="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><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="hspace">&nbsp;</span><span class="RktVal">3.5</span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="hspace">&nbsp;</span><span class="RktVal">"A"</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(#t #t #t #t #f #f)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" class="RktValLink" data-pltdoc="x">map</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._symbolish~3f%29%29" class="RktValLink" data-pltdoc="x">symbolish?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="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><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="hspace">&nbsp;</span><span class="RktVal">3.5</span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="hspace">&nbsp;</span><span class="RktVal">"A"</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(#t #t #t #t #f #f)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" class="RktValLink" data-pltdoc="x">map</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._pathish~3f%29%29" class="RktValLink" data-pltdoc="x">pathish?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="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><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="hspace">&nbsp;</span><span class="RktVal">3.5</span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="hspace">&nbsp;</span><span class="RktVal">"A"</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(#t #t #t #t #f #f)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" class="RktValLink" data-pltdoc="x">map</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._complete-pathish~3f%29%29" class="RktValLink" data-pltdoc="x">complete-pathish?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="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><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="hspace">&nbsp;</span><span class="RktVal">3.5</span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="hspace">&nbsp;</span><span class="RktVal">"A"</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(#t #t #t #t #f #f)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" class="RktValLink" data-pltdoc="x">map</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._listish~3f%29%29" class="RktValLink" data-pltdoc="x">listish?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="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><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="hspace">&nbsp;</span><span class="RktVal">3.5</span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="hspace">&nbsp;</span><span class="RktVal">"A"</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(#t #t #t #t #t #t)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" class="RktValLink" data-pltdoc="x">map</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._vectorish~3f%29%29" class="RktValLink" data-pltdoc="x">vectorish?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="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><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="hspace">&nbsp;</span><span class="RktVal">3.5</span><span class="hspace">&nbsp;</span><span class="RktVal">#\A</span><span class="hspace">&nbsp;</span><span class="RktVal">"A"</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(#t #t #t #t #t #t)</span></p></td></tr></table></blockquote></td></tr></table></p><h4>2.2<tt>&nbsp;</tt><a name="(part._.Coercion_contracts)"></a>Coercion contracts</h4><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._coerce/int~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fint~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">coerce/int?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._coerce/string~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fstring~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">coerce/string?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._coerce/symbol~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fsymbol~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">coerce/symbol?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._coerce/path~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fpath~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">coerce/path?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/Manipulating_Paths.html#%28def._%28%28quote._~23~25kernel%29._path~3f%29%29" class="RktValLink" data-pltdoc="x">path?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="together"><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._((lib._sugar/coerce..rkt)._coerce/boolean~3f))"></a><span title="Provided from: sugar/coerce | Package: sugar"><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fboolean~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">coerce/boolean?</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;&nbsp;</span><span class="RktVar">v</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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></td></tr></table></blockquote></div><div class="SIntrapara">If <span class="RktVar">v</span> can be coerced to the specified type, change it to that type, then return it. If not, raise the usual contract error. These contracts can be used with input or output values.</div></p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/attaching-contracts-to-values.html#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">add-ints</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fint~3f%29%29" class="RktValLink" data-pltdoc="x">coerce/int?</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fint~3f%29%29" class="RktValLink" data-pltdoc="x">coerce/int?</a></span><span class="hspace">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Input arguments will be coerced to integers, then added</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">add-ints</span><span class="hspace">&nbsp;</span><span class="RktVal">1.6</span><span class="hspace">&nbsp;</span><span class="RktVal">3.8</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">4</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/attaching-contracts-to-values.html#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">int-sum</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/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">&nbsp;</span><span class="RktPn">. </span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-&gt;</span></a></span><span class="RktPn"> .</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="Coercion.html#%28def._%28%28lib._sugar%2Fcoerce..rkt%29._coerce%2Fint~3f%29%29" class="RktValLink" data-pltdoc="x">coerce/int?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">Input arguments will be added, and the result coerced to an integer</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">int-sum</span><span class="hspace">&nbsp;</span><span class="RktVal">1.6</span><span class="hspace">&nbsp;</span><span class="RktVal">3.8</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">5</span></p></td></tr></table></blockquote></td></tr></table></p><p>Please note: this is not an officially sanctioned way to use Racket&rsquo;s contract system, because contracts aren&rsquo;t supposed to mutate their values (see <span class="RktSym"><a href="http://docs.racket-lang.org/reference/Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fprop..rkt%29._make-contract%29%29" class="RktValLink" data-pltdoc="x">make-contract</a></span>).</p><p>But coercion contracts can be useful in two situations:</p><ul><li><p>You want to be liberal about input types, but don&rsquo;t want to deal with the housekeeping and manual conversions between types.</p></li><li><p>Your contract involves an expensive operation that you&rsquo;d rather avoid performing twice.</p></li></ul><div class="navsetbottom"><span class="navleft"><div class="nosearchform"></div>&nbsp;&nbsp;</span><span class="navright">&nbsp;&nbsp;<a href="Installation___updates.html" title="backward to &quot;1 Installation &amp; updates&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;Sugar: readability &amp; convenience library&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="Container.html" title="forward to &quot;3 Container&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>