/usr/share/doc/racket/reference/contract-utilities.html is in racket-doc 6.7-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | <!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>8.8 Contract Utilities</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="extras.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x"><span style="font-weight: bold">The Racket Reference</span></a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="model.html" class="tocviewlink" data-pltdoc="x">Language Model</a></td></tr><tr><td align="right">2 </td><td><a href="notation.html" class="tocviewlink" data-pltdoc="x">Notation for Documentation</a></td></tr><tr><td align="right">3 </td><td><a href="syntax.html" class="tocviewlink" data-pltdoc="x">Syntactic Forms</a></td></tr><tr><td align="right">4 </td><td><a href="data.html" class="tocviewlink" data-pltdoc="x">Datatypes</a></td></tr><tr><td align="right">5 </td><td><a href="structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">6 </td><td><a href="mzlib_class.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">7 </td><td><a href="mzlib_unit.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">8 </td><td><a href="contracts.html" class="tocviewselflink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">9 </td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">10 </td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Control Flow</a></td></tr><tr><td align="right">11 </td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr><tr><td align="right">12 </td><td><a href="Macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">13 </td><td><a href="input-and-output.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">14 </td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Reflection and Security</a></td></tr><tr><td align="right">15 </td><td><a href="os.html" class="tocviewlink" data-pltdoc="x">Operating System</a></td></tr><tr><td align="right">16 </td><td><a href="memory.html" class="tocviewlink" data-pltdoc="x">Memory Management</a></td></tr><tr><td align="right">17 </td><td><a href="unsafe.html" class="tocviewlink" data-pltdoc="x">Unsafe Operations</a></td></tr><tr><td align="right">18 </td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">Running Racket</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">▼</a></td><td>8 </td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr></table><div class="tocviewsublistbottom" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">8.1 </td><td><a href="data-structure-contracts.html" class="tocviewlink" data-pltdoc="x">Data-<wbr></wbr>structure Contracts</a></td></tr><tr><td align="right">8.2 </td><td><a href="function-contracts.html" class="tocviewlink" data-pltdoc="x">Function Contracts</a></td></tr><tr><td align="right">8.3 </td><td><a href="parametric-contracts.html" class="tocviewlink" data-pltdoc="x">Parametric Contracts</a></td></tr><tr><td align="right">8.4 </td><td><a href="Lazy_Data-structure_Contracts.html" class="tocviewlink" data-pltdoc="x">Lazy Data-<wbr></wbr>structure Contracts</a></td></tr><tr><td align="right">8.5 </td><td><a href="Structure_Type_Property_Contracts.html" class="tocviewlink" data-pltdoc="x">Structure Type Property Contracts</a></td></tr><tr><td align="right">8.6 </td><td><a href="attaching-contracts-to-values.html" class="tocviewlink" data-pltdoc="x">Attaching Contracts to Values</a></td></tr><tr><td align="right">8.7 </td><td><a href="Building_New_Contract_Combinators.html" class="tocviewlink" data-pltdoc="x">Building New Contract Combinators</a></td></tr><tr><td align="right">8.8 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Contract Utilities</a></td></tr><tr><td align="right">8.9 </td><td><a href="racket_contract_base.html" class="tocviewlink" data-pltdoc="x"><span class="RktModLink"><span class="RktSym">racket/<span class="mywbr"> </span>contract/<span class="mywbr"> </span>base</span></span></a></td></tr><tr><td align="right">8.10 </td><td><a href="Legacy_Contracts.html" class="tocviewlink" data-pltdoc="x">Legacy Contracts</a></td></tr><tr><td align="right">8.11 </td><td><a href="Random_generation.html" class="tocviewlink" data-pltdoc="x">Random generation</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">contract?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._chaperone-contract~3f%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">chaperone-<wbr></wbr>contract?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._impersonator-contract~3f%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">impersonator-<wbr></wbr>contract?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">flat-<wbr></wbr>contract?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">list-<wbr></wbr>contract?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-name%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">contract-<wbr></wbr>name</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._value-contract%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">value-<wbr></wbr>contract</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._has-contract~3f%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">has-<wbr></wbr>contract?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._value-blame%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">value-<wbr></wbr>blame</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._has-blame~3f%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">has-<wbr></wbr>blame?</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-late-neg-projection%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">contract-<wbr></wbr>late-<wbr></wbr>neg-<wbr></wbr>projection</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-projection%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">contract-<wbr></wbr>projection</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-val-first-projection%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">contract-<wbr></wbr>val-<wbr></wbr>first-<wbr></wbr>projection</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._make-none%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">make-<wbr></wbr>none/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._recursive-contract%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">recursive-<wbr></wbr>contract</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._opt%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">opt/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._define-opt%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define-<wbr></wbr>opt/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-continuation-mark-key%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">contract-<wbr></wbr>continuation-<wbr></wbr>mark-<wbr></wbr>key</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-custom-write-property-proc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">contract-<wbr></wbr>custom-<wbr></wbr>write-<wbr></wbr>property-<wbr></wbr>proc</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._rename-contract%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">rename-<wbr></wbr>contract</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract-first-order-okay-to-give-up~3f%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym">contract-<wbr></wbr>first-<wbr></wbr>order-<wbr></wbr>okay-<wbr></wbr>to-<wbr></wbr>give-<wbr></wbr>up?</span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract-first-order-try-less-hard%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym">contract-<wbr></wbr>first-<wbr></wbr>order-<wbr></wbr>try-<wbr></wbr>less-<wbr></wbr>hard</span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._if%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">if/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._failure-result%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">failure-<wbr></wbr>result/<span class="mywbr"> </span>c</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="Building_New_Contract_Combinators.html" title="backward to "8.7 Building New Contract Combinators"" data-pltdoc="x">← prev</a> <a href="contracts.html" title="up to "8 Contracts"" data-pltdoc="x">up</a> <a href="racket_contract_base.html" title="forward to "8.9 racket/contract/base"" data-pltdoc="x">next →</a></span> </div><h4 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""contract-utilities"">8.8<tt> </tt><a name="(part._contract-utilities)"></a>Contract Utilities</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._racket/contract/private/guts..rkt)._contract~3f))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">contract?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if its argument is a <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contract</span></a> (i.e., constructed
with one of the combinators described in this section or a value that
can be used as a contract) and <span class="RktVal">#f</span> otherwise.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/guts..rkt)._chaperone-contract~3f))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._chaperone-contract~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">chaperone-contract?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if its argument is a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a>,
i.e., one that guarantees that
it returns a value which passes <span class="RktSym"><a href="chaperones.html#%28def._%28%28quote._~23~25kernel%29._chaperone-of~3f%29%29" class="RktValLink" data-pltdoc="x">chaperone-of?</a></span> when compared to
the original, uncontracted value.</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._racket/contract/private/guts..rkt)._impersonator-contract~3f))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._impersonator-contract~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">impersonator-contract?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if its argument is an <a href="contracts.html#%28tech._impersonator._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">impersonator contract</span></a>,
i.e., a <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contract</span></a> that is neither a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a>
nor a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>.</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._racket/contract/private/guts..rkt)._flat-contract~3f))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">flat-contract?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> when its argument is a contract that can be
checked immediately (unlike, say, a function contract).</div></p><p>For example,
<span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._flat-contract%29%29" class="RktValLink" data-pltdoc="x">flat-contract</a></span> constructs <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a> from predicates, and
symbols, booleans, numbers, and other ordinary Racket values
(that are defined as <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contracts</span></a>) are also
<a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>.</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._racket/contract/private/guts..rkt)._list-contract~3f))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">list-contract?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Recognizes certain <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span> values that accept <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._list~3f%29%29" class="RktValLink" data-pltdoc="x">list?</a></span>s.</div></p><p>A list contract is one that insists that its argument
is a <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._list~3f%29%29" class="RktValLink" data-pltdoc="x">list?</a></span>, meaning that the value cannot be cyclic
and must either be the empty list or a pair constructed
with <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span> and another list.</p><p class="SHistory">Added in version 6.0.1.13 of package <span class="stt">base</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/guts..rkt)._contract-name))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-name%29%29" class="RktValDef RktValLink" data-pltdoc="x">contract-name</a></span></span><span class="hspace"> </span><span class="RktVar">c</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces the name used to describe the contract in error messages.</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._racket/contract/private/guts..rkt)._value-contract))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._value-contract%29%29" class="RktValDef RktValLink" data-pltdoc="x">value-contract</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._has-contract~3f%29%29" class="RktValLink" data-pltdoc="x">has-contract?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the contract attached to <span class="RktVar">v</span>, if recorded.
Otherwise it returns <span class="RktVal">#f</span>.</div></p><p>To support <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._value-contract%29%29" class="RktValLink" data-pltdoc="x">value-contract</a></span> and <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._value-contract%29%29" class="RktValLink" data-pltdoc="x">value-contract</a></span>
in your own contract combinators, use <span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._prop~3acontracted%29%29" class="RktValLink" data-pltdoc="x">prop:contracted</a></span> or
<span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._impersonator-prop~3acontracted%29%29" class="RktValLink" data-pltdoc="x">impersonator-prop:contracted</a></span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/guts..rkt)._has-contract~3f))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._has-contract~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">has-contract?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <span class="RktVar">v</span> is a value that
has a recorded contract attached to it.</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._racket/contract/private/guts..rkt)._value-blame))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._value-blame%29%29" class="RktValDef RktValLink" data-pltdoc="x">value-blame</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fblame..rkt%29._blame~3f%29%29" class="RktValLink" data-pltdoc="x">blame?</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._has-blame~3f%29%29" class="RktValLink" data-pltdoc="x">has-blame?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns the <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&rel=Building_New_Contracts.html%23%2528tech._blame._object%2529&version=6.7" class="techoutside Sq" data-pltdoc="x"><span class="techinside">blame object</span></a> for the contract attached
to <span class="RktVar">v</span>, if recorded. Otherwise it returns <span class="RktVal">#f</span>.</div></p><p>To support <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._value-contract%29%29" class="RktValLink" data-pltdoc="x">value-contract</a></span> and <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._value-blame%29%29" class="RktValLink" data-pltdoc="x">value-blame</a></span>
in your own contract combinators, use <span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._prop~3ablame%29%29" class="RktValLink" data-pltdoc="x">prop:blame</a></span> or
<span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._impersonator-prop~3ablame%29%29" class="RktValLink" data-pltdoc="x">impersonator-prop:blame</a></span>.</p><p class="SHistory">Added in version 6.0.1.12 of package <span class="stt">base</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/guts..rkt)._has-blame~3f))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._has-blame~3f%29%29" class="RktValDef RktValLink" data-pltdoc="x">has-blame?</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns <span class="RktVal">#t</span> if <span class="RktVar">v</span> is a value that
has a contract with blame information attached to it.</div></p><p class="SHistory">Added in version 6.0.1.12 of package <span class="stt">base</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/guts..rkt)._contract-late-neg-projection))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-late-neg-projection%29%29" class="RktValDef RktValLink" data-pltdoc="x">contract-late-neg-projection</a></span></span><span class="hspace"> </span><span class="RktVar">c</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fblame..rkt%29._blame~3f%29%29" class="RktValLink" data-pltdoc="x">blame?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces the projection defining a contract’s behavior.</div></p><p>The first argument, <span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fblame..rkt%29._blame~3f%29%29" class="RktValLink" data-pltdoc="x">blame?</a></span> object encapsulates information about
the contract checking, mostly used to create a meaningful error message if
a contract violation is detected. The resulting function’s first argument
is the value that should have the contract and its second argument is
a “missing party” from the blame object, to be passed to <span class="RktSym"><a href="Legacy_Contracts.html#%28def._%28%28lib._racket%2Fcontract..rkt%29._raise-contract-error%29%29" class="RktValLink" data-pltdoc="x">raise-contract-error</a></span>.</p><p>If possible, use this function instead of <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-val-first-projection%29%29" class="RktValLink" data-pltdoc="x">contract-val-first-projection</a></span> or
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-projection%29%29" class="RktValLink" data-pltdoc="x">contract-projection</a></span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/guts..rkt)._contract-projection))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-projection%29%29" class="RktValDef RktValLink" data-pltdoc="x">contract-projection</a></span></span><span class="hspace"> </span><span class="RktVar">c</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fblame..rkt%29._blame~3f%29%29" class="RktValLink" data-pltdoc="x">blame?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces the projection defining a contract’s behavior. See also
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-late-neg-projection%29%29" class="RktValLink" data-pltdoc="x">contract-late-neg-projection</a></span>.</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._racket/contract/private/guts..rkt)._contract-val-first-projection))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-val-first-projection%29%29" class="RktValDef RktValLink" data-pltdoc="x">contract-val-first-projection</a></span></span><span class="hspace"> </span><span class="RktVar">c</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fblame..rkt%29._blame~3f%29%29" class="RktValLink" data-pltdoc="x">blame?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces the projection defining a contract’s behavior.
See also <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-late-neg-projection%29%29" class="RktValLink" data-pltdoc="x">contract-late-neg-projection</a></span>.</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._racket/contract/private/misc..rkt)._make-none/c))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._make-none%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">make-none/c</a></span></span><span class="hspace"> </span><span class="RktVar">sexp-name</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">sexp-name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Makes a contract that accepts no values, and reports the
name <span class="RktVar">sexp-name</span> when signaling a contract violation.</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>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/contract/private/base..rkt)._recursive-contract))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._recursive-contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">recursive-contract</a></span></span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._recursive-contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">recursive-contract</a></span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="hspace"> </span><span class="RktPn">#:list-contract?</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._recursive-contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">recursive-contract</a></span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="hspace"> </span><span class="RktVar">type</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._recursive-contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">recursive-contract</a></span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="hspace"> </span><span class="RktVar">type</span><span class="hspace"> </span><span class="RktPn">#:list-contract?</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Delays the evaluation of its argument until the contract is checked,
making recursive contracts possible. If <span class="RktVar">type</span> is given, it
describes the expected type of contract and must be one of the keywords
<span class="RktPn">#:impersonator</span>, <span class="RktPn">#:chaperone</span>, or <span class="RktPn">#:flat</span>. If
<span class="RktVar">type</span> is not given, an impersonator contract is created.</div></p><p>If <span class="RktPn">#:list-contract?</span> is returned, then the result is a
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValLink" data-pltdoc="x">list-contract?</a></span> and the <span class="RktVar">contract-expr</span> must evaluate
to a <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValLink" data-pltdoc="x">list-contract?</a></span>.</p><p class="SHistory">Changed in version 6.0.1.13 of package <span class="stt">base</span>: Added the <span class="RktPn">#:list-contract?</span> argument.</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>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/contract/private/opt..rkt)._opt/c))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._opt%2Fc%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">opt/c</a></span></span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="hspace"> </span><span class="RktVar">maybe-name</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="stt"> </span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="specgrammar"><tr><td align="right" valign="baseline"><span class="RktVar">maybe-name</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:error-name</span><span class="hspace"> </span><span class="RktVar">id</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">This optimizes its argument contract expression by
traversing its syntax and, for known contract combinators,
fuses them into a single contract combinator that avoids as
much allocation overhead as possible. The result is a
contract that should behave identically to its argument,
except faster.</div></p><p>If the <span class="RktPn">#:error-name</span> argument is present, and
<span class="RktVar">contract-expr</span> evaluates to a non-contract
expression, then <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._opt%2Fc%29%29" class="RktStxLink" data-pltdoc="x">opt/c</a></span> raises an error using
<span class="RktVar">id</span> as the name of the primitive, instead of using
the name <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._opt%2Fc%29%29" class="RktStxLink" data-pltdoc="x">opt/c</a></span>.</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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"> </span><span class="RktPn">(</span><span class="RktSym">f</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._opt%2Fc%29%29" class="RktStxLink" data-pltdoc="x">opt/c</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">not-a-contract</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">opt/c: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">expected: contract?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">given: '(not-a-contract)</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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"> </span><span class="RktPn">(</span><span class="RktSym">f</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._opt%2Fc%29%29" class="RktStxLink" data-pltdoc="x">opt/c</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">not-a-contract</span><span class="RktVal">)</span><span class="hspace"> </span><span class="RktPn">#:error-name</span><span class="hspace"> </span><span class="RktSym"><a href="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="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">define/contract: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">expected: contract?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">given: '(not-a-contract)</span></p></td></tr></table></blockquote></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>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/contract/private/opt..rkt)._define-opt/c))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._define-opt%2Fc%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-opt/c</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">This defines a recursive contract and simultaneously
optimizes it. As long as the defined function terminates,
<span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._define-opt%2Fc%29%29" class="RktStxLink" data-pltdoc="x">define-opt/c</a></span> behaves just as if
the <span class="RktSym"><span class="nobreak">-o</span>pt/c</span> were not present, defining a function on
contracts (except that the body expression must return a
contract). But, it also optimizes that contract definition,
avoiding extra allocation, much like <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._opt%2Fc%29%29" class="RktStxLink" data-pltdoc="x">opt/c</a></span> does.</div></p><p>For example,</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="Lazy_Data-structure_Contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fds..rkt%29._define-contract-struct%29%29" class="RktStxLink" data-pltdoc="x">define-contract-struct</a></span><span class="hspace"> </span><span class="RktSym">bt</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">val</span><span class="hspace"> </span><span class="RktSym">left</span><span class="hspace"> </span><span class="RktSym">right</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._define-opt%2Fc%29%29" class="RktStxLink" data-pltdoc="x">define-opt/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">bst-between/c</span><span class="hspace"> </span><span class="RktSym">lo</span><span class="hspace"> </span><span class="RktSym">hi</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._null~3f%29%29" class="RktValLink" data-pltdoc="x">null?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">bt/c</span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">val</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._real-in%29%29" class="RktValLink" data-pltdoc="x">real-in</a></span><span class="hspace"> </span><span class="RktSym">lo</span><span class="hspace"> </span><span class="RktSym">hi</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">left</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">val</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">bst-between/c</span><span class="hspace"> </span><span class="RktSym">lo</span><span class="hspace"> </span><span class="RktSym">val</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">right</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">val</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">bst-between/c</span><span class="hspace"> </span><span class="RktSym">val</span><span class="hspace"> </span><span class="RktSym">hi</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">bst/c</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">bst-between/c</span><span class="hspace"> </span><span class="RktVal"><span class="nobreak">-i</span>nf.0</span><span class="hspace"> </span><span class="RktVal">+inf.0</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>defines the <span class="RktSym">bst/c</span> contract that checks the binary
search tree invariant. Removing the <span class="RktSym"><span class="nobreak">-o</span>pt/c</span> also
makes a binary search tree contract, but one that is
(approximately) 20 times slower.</p><p>Note that in some cases, a call to a function defined by
<span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._define-opt%2Fc%29%29" class="RktStxLink" data-pltdoc="x">define-opt/c</a></span> may terminate, even if the corresponding
<span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span>-based function would not terminate. This is a
shortcoming in <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fopt..rkt%29._define-opt%2Fc%29%29" class="RktStxLink" data-pltdoc="x">define-opt/c</a></span> that we hope to understand
and fix at some point, but have no concrete plans currently.</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>value</p></div></div><p class="RForeground"><a name="(def._((lib._racket/contract/private/guts..rkt)._contract-continuation-mark-key))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-continuation-mark-key%29%29" class="RktValDef RktValLink" data-pltdoc="x">contract-continuation-mark-key</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-key~3f%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-key?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Key used by continuation marks that are present during contract checking.
The value of these marks are the <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&rel=Building_New_Contracts.html%23%2528tech._blame._object%2529&version=6.7" class="techoutside Sq" data-pltdoc="x"><span class="techinside">blame objects</span></a> that correspond to the contract
currently being checked.</div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/guts..rkt)._contract-custom-write-property-proc))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-custom-write-property-proc%29%29" class="RktValDef RktValLink" data-pltdoc="x">contract-custom-write-property-proc</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">c</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">p</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td></tr><tr><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">mode</span><span class="RktPn">)</span></td><td valign="top"><span class="hspace"> </span></td><td valign="top">→</td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktSym"><a href="void.html#%28def._%28%28quote._~23~25kernel%29._void~3f%29%29" class="RktValLink" data-pltdoc="x">void?</a></span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">p</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="port-ops.html#%28def._%28%28quote._~23~25kernel%29._output-port~3f%29%29" class="RktValLink" data-pltdoc="x">output-port?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">mode</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="hspace"> </span><span class="RktVal">0</span><span class="hspace"> </span><span class="RktVal">1</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Prints <span class="RktVar">c</span> to <span class="RktVar">p</span> using the contract’s name.</div></p><p class="SHistory">Added in version 6.1.1.5 of package <span class="stt">base</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/misc..rkt)._rename-contract))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._rename-contract%29%29" class="RktValDef RktValLink" data-pltdoc="x">rename-contract</a></span></span><span class="hspace"> </span><span class="RktVar">contract</span><span class="hspace"> </span><span class="RktVar">name</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">contract</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">name</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces a contract that acts like <span class="RktVar">contract</span> but with the name
<span class="RktVar">name</span>.</div></p><p>The resulting contract is a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> if <span class="RktVar">contract</span> is a
<a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>.</p><p class="SHistory">Added in version 6.3 of package <span class="stt">base</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/contract/private/base..rkt)._contract-first-order-okay-to-give-up~3f))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><span class="RktSymDef RktSym">contract-first-order-okay-to-give-up?</span></span></span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">This form returns a boolean that controls the result
of first-order contact checks. More specifically, if
it returns <span class="RktVal">#t</span>, then a first-order check may
return <span class="RktVal">#t</span> even when the entire first-order
checks have not happened. If it returns <span class="RktVal">#f</span>
then the first order checks must continue until a
definitive answer is returned.</div></p><p>This will only return <span class="RktVal">#t</span> in the dynamic
extent of <span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span> or <span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._first-or%2Fc%29%29" class="RktValLink" data-pltdoc="x">first-or/c</a></span>’s
checking to determine which branch to use.</p><p><div class="SIntrapara"><p class="SHistory">Added in version 6.3.0.9 of package <span class="stt">base</span>.</p></div><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>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/contract/private/base..rkt)._contract-first-order-try-less-hard))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><span class="RktSymDef RktSym">contract-first-order-try-less-hard</span></span></span><span class="hspace"> </span><span class="RktVar">e</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Encourages first-order checks that happen in the
dynamic-extent of <span class="RktVar">e</span> to be more likely to
give up. That is, makes it more likely that
<span class="RktSym">contract-first-order-okay-to-give-up?</span> might
return <span class="RktVal">#t</span>.</div></p><p>If not in the dynamic-extent of <span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span>’s or
<span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._first-or%2Fc%29%29" class="RktValLink" data-pltdoc="x">first-or/c</a></span>’s checking to determine the branch,
then this form has no effect.</p><p class="SHistory">Added in version 6.3.0.9 of package <span class="stt">base</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/misc..rkt)._if/c))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._if%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">if/c</a></span></span><span class="hspace"> </span><span class="RktVar">predicate</span><span class="hspace"> </span><span class="RktVar">then-contract</span><span class="hspace"> </span><span class="RktVar">else-contract</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">predicate</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">then-contract</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">else-contract</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces a contract that, when applied to a value, first tests the
value with <span class="RktVar">predicate</span>; if <span class="RktVar">predicate</span> returns true, the
<span class="RktVar">then-contract</span> is applied; otherwise, the
<span class="RktVar">else-contract</span> is applied. The resulting contract is a
<a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> if both <span class="RktVar">then-contract</span> and <span class="RktVar">else-contract</span> are
<a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>.</div></p><p><div class="SIntrapara">For example, the following contract enforces that if a value is a
procedure, it is a thunk; otherwise it can be any (non-procedure)
value:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._if%2Fc%29%29" class="RktValLink" data-pltdoc="x">if/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="procedures.html#%28def._%28%28quote._~23~25kernel%29._procedure~3f%29%29" class="RktValLink" data-pltdoc="x">procedure?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span></p></blockquote></div><div class="SIntrapara">Note that the following contract is <span style="font-weight: bold">not</span> equivalent:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">wrong!</span></p></blockquote></div><div class="SIntrapara">The last contract is the same as <span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span> because
<span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span> tries <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a> before higher-order contracts.</div></p><p class="SHistory">Added in version 6.3 of package <span class="stt">base</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>value</p></div></div><p class="RForeground"><a name="(def._((lib._racket/contract/base..rkt)._failure-result/c))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._failure-result%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">failure-result/c</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A contract that describes the failure result arguments of procedures
such as <span class="RktSym"><a href="hashtables.html#%28def._%28%28quote._~23~25kernel%29._hash-ref%29%29" class="RktValLink" data-pltdoc="x">hash-ref</a></span>.</div></p><p>Equivalent to <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._if%2Fc%29%29" class="RktValLink" data-pltdoc="x">if/c</a></span><span class="stt"> </span><span class="RktSym"><a href="procedures.html#%28def._%28%28quote._~23~25kernel%29._procedure~3f%29%29" class="RktValLink" data-pltdoc="x">procedure?</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="stt"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span><span class="RktPn">)</span><span class="stt"> </span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span>.</p><p class="SHistory">Added in version 6.3 of package <span class="stt">base</span>.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.7", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.7");">top</a></span><span class="navright"> <a href="Building_New_Contract_Combinators.html" title="backward to "8.7 Building New Contract Combinators"" data-pltdoc="x">← prev</a> <a href="contracts.html" title="up to "8 Contracts"" data-pltdoc="x">up</a> <a href="racket_contract_base.html" title="forward to "8.9 racket/contract/base"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|