/usr/share/doc/racket/reference/data-structure-contracts.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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | <!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.1 Data-structure Contracts</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="" class="tocviewselflink" 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="contract-utilities.html" class="tocviewlink" 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%2Fbase..rkt%29._flat-contract-with-reason%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym">flat-<wbr></wbr>contract-<wbr></wbr>with-<wbr></wbr>reason</span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._flat-named-contract%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">flat-<wbr></wbr>named-<wbr></wbr>contract</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">any/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._none%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">none/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">or/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._first-or%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">first-<wbr></wbr>or/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._and%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">and/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._not%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">not/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3d%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">=/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3c%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink"></<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3e%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">>/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3c~3d%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink"><=/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3e~3d%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">>=/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._between%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">between/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._real-in%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">real-<wbr></wbr>in</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._integer-in%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">integer-<wbr></wbr>in</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._char-in%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">char-<wbr></wbr>in</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._natural-number%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">natural-<wbr></wbr>number/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._string-len%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">string-<wbr></wbr>len/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._false%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">false/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._printable%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">printable/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._one-of%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">one-<wbr></wbr>of/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._symbols%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">symbols</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fvector..rkt%29._vectorof%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">vectorof</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fvector..rkt%29._vector-immutableof%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">vector-<wbr></wbr>immutableof</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fvector..rkt%29._vector%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">vector/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fvector..rkt%29._vector-immutable%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">vector-<wbr></wbr>immutable/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fbox..rkt%29._box%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">box/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fbox..rkt%29._box-immutable%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">box-<wbr></wbr>immutable/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._listof%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">listof</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._non-empty-listof%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">non-<wbr></wbr>empty-<wbr></wbr>listof</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._list%2Aof%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">list*of</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._cons%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">cons/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._cons%2Fdc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">cons/<span class="mywbr"> </span>dc</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._list%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">list/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._%2Alist%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">*list/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._syntax%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">syntax/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fstruct-dc..rkt%29._struct%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">struct/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fstruct-dc..rkt%29._struct%2Fdc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">struct/<span class="mywbr"> </span>dc</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._parameter%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">parameter/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._procedure-arity-includes%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">procedure-<wbr></wbr>arity-<wbr></wbr>includes/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">hash/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fdc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">hash/<span class="mywbr"> </span>dc</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._channel%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">channel/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._prompt-tag%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">prompt-<wbr></wbr>tag/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._continuation-mark-key%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">continuation-<wbr></wbr>mark-<wbr></wbr>key/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._evt%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">evt/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._flat-rec-contract%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">flat-<wbr></wbr>rec-<wbr></wbr>contract</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._flat-murec-contract%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">flat-<wbr></wbr>murec-<wbr></wbr>contract</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">any</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._promise%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">promise/<span class="mywbr"> </span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._flat-contract%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%2Fmisc..rkt%29._flat-contract-predicate%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">flat-<wbr></wbr>contract-<wbr></wbr>predicate</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._suggest%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">suggest/<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="contracts.html" title="backward to "8 Contracts"" data-pltdoc="x">← prev</a> <a href="contracts.html" title="up to "8 Contracts"" data-pltdoc="x">up</a> <a href="function-contracts.html" title="forward to "8.2 Function Contracts"" data-pltdoc="x">next →</a></span> </div><h4 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-source-pkg="racket-doc" x-part-tag=""data-structure-contracts"">8.1<tt> </tt><a name="(part._data-structure-contracts)"></a>Data-structure Contracts</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/base..rkt)._flat-contract-with-reason))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><span class="RktSymDef RktSym">flat-contract-with-reason</span></span></span><span class="hspace"> </span><span class="RktVar">get-reason</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">get-reason</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="#%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="#%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="booleans.html#%28def._%28%28quote._~23~25kernel%29._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</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="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="RktSym"><a href="#%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="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Provides a way to use flat contracts that, when a contract fails,
provide more information about the failure.</div></p><p>If <span class="RktVar">get-reason</span> returns a boolean, then that boolean value is
treated as the predicate in a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>. If it returns
a procedure, then it is treated similarly to returning <span class="RktVal">#f</span>,
except the result procedure is called to actually signal the contract
violation.</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym">flat-contract-with-reason</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">λ</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">val</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="if.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._cond%29%29" class="RktStxLink" data-pltdoc="x">cond</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._even~3f%29%29" class="RktValLink" data-pltdoc="x">even?</a></span><span class="hspace"> </span><span class="RktSym">val</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym"><a href="if.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._else%29%29" class="RktStxLink" data-pltdoc="x">else</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">λ</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">blame</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">more-information</span><span class="hspace"> </span><span class="RktSym">...do-some-complex-computation-here...</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fblame..rkt%29._raise-blame-error%29%29" class="RktValLink" data-pltdoc="x">raise-blame-error</a></span><span class="hspace"> </span><span class="RktSym">blame</span><span class="hspace"> </span><span class="RktSym">val</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">expected:</span><span class="hspace"> </span><span class="RktVal">"an even number"</span><span class="hspace"> </span><span class="RktVal">given:</span><span class="hspace"> </span><span class="RktVal">"~e"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">"and, here is more help: ~s"</span><span class="RktVal">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym">val</span><span class="hspace"> </span><span class="RktSym">more-information</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/misc..rkt)._flat-named-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._flat-named-contract%29%29" class="RktValDef RktValLink" data-pltdoc="x">flat-named-contract</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">name</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">flat-contract</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">generator</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="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></td></tr></table></blockquote></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="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">flat-contract</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">generator</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%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="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="attaching-contracts-to-values.html#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract%29%29" class="RktStxLink" data-pltdoc="x">contract</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">int?</span><span class="hspace"> </span><span class="RktSym"><a href="#%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="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Produces a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> like <span class="RktVar">flat-contract</span>, but with the name <span class="RktVar">name</span>.</div></p><p><div class="SIntrapara">For example,
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><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="RktSym">i</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._flat-named-contract%29%29" class="RktValLink" data-pltdoc="x">flat-named-contract</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">odd-integer</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="if.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._and%29%29" class="RktStxLink" data-pltdoc="x">and</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._odd~3f%29%29" class="RktValLink" data-pltdoc="x">odd?</a></span><span class="hspace"> </span><span class="RktSym">x</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><span class="RktVal">2</span><span class="RktPn">)</span></td></tr></table></blockquote></div></p><p>The generator argument adds a generator for the flat-named-contract. See
<span class="RktSym"><a href="Random_generation.html#%28def._%28%28lib._racket%2Fcontract..rkt%29._contract-random-generate%29%29" class="RktValLink" data-pltdoc="x">contract-random-generate</a></span> for more information.</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/misc..rkt)._any/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._any%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">any/c</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that accepts any value.</div></p><p>When using this contract as the result portion of a function contract,
consider using <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span> instead; using <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span> leads to
better memory performance, but it also allows multiple results.</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/misc..rkt)._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._none%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">none/c</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that accepts no values.</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/base..rkt)._or/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._or%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">or/c</a></span></span><span class="hspace"> </span><span class="RktVar">contract</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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="contract-utilities.html#%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">Takes any number of <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contracts</span></a> and returns
a <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contract</span></a> that accepts any value that any one of the contracts
accepts individually.</div></p><p>The <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span> result tests any value by applying the contracts in
order, from left to right, with the exception that it always moves the
non-<a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a> (if any) to the end, checking them
last. Thus, a contract such as <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._not%2Fc%29%29" class="RktValLink" data-pltdoc="x">not/c</a></span><span class="stt"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span><span class="RktPn">)</span><span class="stt"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._positive~3f%29%29" class="RktValLink" data-pltdoc="x">positive?</a></span><span class="RktPn">)</span> is guaranteed to only invoke the <span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._positive~3f%29%29" class="RktValLink" data-pltdoc="x">positive?</a></span>
predicate on real numbers.</p><p>If all of the arguments are procedures or <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>, the
result is a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>. If only one of the arguments is a
higher-order contract, the result is a contract that just checks the
flat contracts and, if they don’t pass, applies the higher-order
contract.</p><p><div class="SIntrapara">If there are multiple higher-order contracts, <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span> uses
<span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-first-order-passes~3f%29%29" class="RktValLink" data-pltdoc="x">contract-first-order-passes?</a></span> to distinguish between
them. More precisely, when an <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span> is checked, it first
checks all of the <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>. If none of them pass, it
calls <span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-first-order-passes~3f%29%29" class="RktValLink" data-pltdoc="x">contract-first-order-passes?</a></span> with each of the
higher-order contracts. If only one returns true, <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span> uses
that contract. If none of them return true, it signals a contract
violation. If more than one returns true, it also signals a contract
violation.
For example, this contract
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%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="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="RktPn">)</span></td></tr><tr><td><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="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">does not accept a function like this one: <span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span><span class="stt"> </span><span class="RktSym">args</span><span class="stt"> </span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._......%29%29" class="RktStxLink" data-pltdoc="x">...</a></span><span class="RktPn">)</span>
since it cannot tell which of the two arrow contracts should be used
with the function.</div></p><p>If all of its arguments are <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValLink" data-pltdoc="x">list-contract?</a></span>s, then <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></span>
returns a <span class="RktSym"><a href="contract-utilities.html#%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><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/base..rkt)._first-or/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._first-or%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">first-or/c</a></span></span><span class="hspace"> </span><span class="RktVar">contract</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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="contract-utilities.html#%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">Takes any number of <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contracts</span></a> and returns a <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contract</span></a> that
accepts any value that any one of the contracts accepts
individually.</div></p><p>The <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._first-or%2Fc%29%29" class="RktValLink" data-pltdoc="x">first-or/c</a></span> result tests any value by applying the
contracts in order from left to right. Thus, a contract
such as <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._first-or%2Fc%29%29" class="RktValLink" data-pltdoc="x">first-or/c</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._not%2Fc%29%29" class="RktValLink" data-pltdoc="x">not/c</a></span><span class="stt"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span><span class="RktPn">)</span><span class="stt"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._positive~3f%29%29" class="RktValLink" data-pltdoc="x">positive?</a></span><span class="RktPn">)</span>
is guaranteed to only invoke the
<span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._positive~3f%29%29" class="RktValLink" data-pltdoc="x">positive?</a></span> predicate on real numbers.</p><p>If all of the arguments are procedures or <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat
contracts</span></a>, the result is a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> and
similarly if all of the arguments are <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone
contracts</span></a> the result is too. Otherwise, the result is an
<a href="contracts.html#%28tech._impersonator._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">impersonator contract</span></a>.</p><p>If there are multiple higher-order contracts,
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._first-or%2Fc%29%29" class="RktValLink" data-pltdoc="x">first-or/c</a></span> uses <span class="RktSym"><a href="Building_New_Contract_Combinators.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract-first-order-passes~3f%29%29" class="RktValLink" data-pltdoc="x">contract-first-order-passes?</a></span>
to distinguish between them. More precisely, when an
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._first-or%2Fc%29%29" class="RktValLink" data-pltdoc="x">first-or/c</a></span> is checked, it checks the first order passes
of the first contract against the value. If it succeeds,
then it uses only that contract. If it fails, then it moves
to the second contract, continuing until it finds one of
the contracts where the first order check succeeds. If none
of them do, a contract violation is signaled.</p><p><div class="SIntrapara">For example, this contract
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._first-or%2Fc%29%29" class="RktValLink" data-pltdoc="x">first-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="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="RktPn">)</span></td></tr><tr><td><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="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">accepts the function <span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">λ</a></span><span class="stt"> </span><span class="RktSym">args</span><span class="stt"> </span><span class="RktVal">0</span><span class="RktPn">)</span>,
applying the <span class="RktPn">(</span><span class="RktSym"><span class="nobreak">-></span>number?</span><span class="stt"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="RktPn">)</span> contract to the function
because it comes first, even though
<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="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="stt"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="stt"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="RktPn">)</span> also applies.</div></p><p>If all of its arguments are <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValLink" data-pltdoc="x">list-contract?</a></span>s, then <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._first-or%2Fc%29%29" class="RktValLink" data-pltdoc="x">first-or/c</a></span>
returns a <span class="RktSym"><a href="contract-utilities.html#%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><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/base..rkt)._and/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._and%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">and/c</a></span></span><span class="hspace"> </span><span class="RktVar">contract</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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="contract-utilities.html#%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">Takes any number of <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contracts</span></a> and returns a <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contract</span></a> that
accepts any value that satisfies all of the contracts simultaneously.</div></p><p>If all of the arguments are procedures or <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>,
the result is a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>.</p><p>The contract produced by <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._and%2Fc%29%29" class="RktValLink" data-pltdoc="x">and/c</a></span> tests any value by applying
the contracts in order, from left to right.</p><p>This means that <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._and%2Fc%29%29" class="RktValLink" data-pltdoc="x">and/c</a></span> can be used to guard predicates that are not
total in contracts. For example, this contract is well-behaved, correctly
blaming the definition of <span class="RktSym">whoops-not-a-number</span> for not being
a number:</p><p><div class="SIntrapara"><p><div class="SIntrapara">Example:</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="RktSym">whoops-not-a-number</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._and%2Fc%29%29" class="RktValLink" data-pltdoc="x">and/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._even~3f%29%29" class="RktValLink" data-pltdoc="x">even?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">"four"</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">whoops-not-a-number: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: real?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: "four"</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: an and/c case of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(and/c real? even?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: </span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(definition whoops-not-a-number)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition whoops-not-a-number)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:2.0</span></p></td></tr></table></blockquote></div></p></div><div class="SIntrapara">but if the arguments to <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._and%2Fc%29%29" class="RktValLink" data-pltdoc="x">and/c</a></span> are reversed, then the contract itself raises
an error:
</div><div class="SIntrapara"><p><div class="SIntrapara">Example:</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="RktSym">whoops-not-a-number</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._and%2Fc%29%29" class="RktValLink" data-pltdoc="x">and/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._even~3f%29%29" class="RktValLink" data-pltdoc="x">even?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">"four"</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">even?: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">expected: integer</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">given: "four"</span></p></td></tr></table></blockquote></div></p></div></p><p>If more than one of the contracts are not <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>,
then the order in which the higher-order parts of the contract are tested
can be counter-intuitive. As an example, consider this function that
uses <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._and%2Fc%29%29" class="RktValLink" data-pltdoc="x">and/c</a></span> in a higher-order manner with contracts that
always succeed, but that print when they are called, in order for us
to see the order in which they are called.</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym">show-me</span><span class="hspace"> </span><span class="RktSym">n</span><span class="RktPn">)</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="Writing.html#%28def._%28%28quote._~23~25kernel%29._printf%29%29" class="RktValLink" data-pltdoc="x">printf</a></span><span class="hspace"> </span><span class="RktVal">"show-me ~a\n"</span><span class="hspace"> </span><span class="RktSym">n</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">identity-with-complex-printing-contract</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._and%2Fc%29%29" class="RktValLink" data-pltdoc="x">and/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="RktPn">(</span><span class="RktSym">show-me</span><span class="hspace"> </span><span class="RktVal">4</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">show-me</span><span class="hspace"> </span><span class="RktVal">5</span><span class="RktPn">)</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="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">show-me</span><span class="hspace"> </span><span class="RktVal">3</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">show-me</span><span class="hspace"> </span><span class="RktVal">6</span><span class="RktPn">)</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="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">show-me</span><span class="hspace"> </span><span class="RktVal">2</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">show-me</span><span class="hspace"> </span><span class="RktVal">7</span><span class="RktPn">)</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="function-contracts.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._-~3e%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">show-me</span><span class="hspace"> </span><span class="RktVal">1</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">show-me</span><span class="hspace"> </span><span class="RktVal">8</span><span class="RktPn">)</span><span class="RktPn">)</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="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">λ</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">identity-with-complex-printing-contract</span><span class="hspace"> </span><span class="RktVal">101</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="RktOut">show-me 1</span></p></td></tr><tr><td><p><span class="RktOut">show-me 2</span></p></td></tr><tr><td><p><span class="RktOut">show-me 3</span></p></td></tr><tr><td><p><span class="RktOut">show-me 4</span></p></td></tr><tr><td><p><span class="RktOut">show-me 5</span></p></td></tr><tr><td><p><span class="RktOut">show-me 6</span></p></td></tr><tr><td><p><span class="RktOut">show-me 7</span></p></td></tr><tr><td><p><span class="RktOut">show-me 8</span></p></td></tr></table></td></tr><tr><td><p><span class="RktRes">101</span></p></td></tr></table></blockquote></div></p><p>The checking order is just like the usual ordering when a contract
is double-wrapped. The contract that is first put on has its domain checked
second but its range checked first and we see a similar pattern here in
this example, because <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._and%2Fc%29%29" class="RktValLink" data-pltdoc="x">and/c</a></span> simply applies the contracts in order.</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)._not/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._not%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">not/c</a></span></span><span class="hspace"> </span><span class="RktVar">flat-contract</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">flat-contract</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Accepts a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> or a predicate and returns a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>
that checks the inverse of the argument.</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)._~3d/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._~3d%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">=/c</a></span></span><span class="hspace"> </span><span class="RktVar">z</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">z</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that requires the input to be a number and
<span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._~3d%29%29" class="RktValLink" data-pltdoc="x">=</a></span> to <span class="RktVar">z</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)._~3c/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._~3c%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x"></c</a></span></span><span class="hspace"> </span><span class="RktVar">n</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that requires the input to be a number and
<span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._~3c%29%29" class="RktValLink" data-pltdoc="x"><</a></span> than <span class="RktVar">n</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)._~3e/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._~3e%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">>/c</a></span></span><span class="hspace"> </span><span class="RktVar">n</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3c%2Fc%29%29" class="RktValLink" data-pltdoc="x"></c</a></span>, but for <span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._~3e%29%29" class="RktValLink" data-pltdoc="x">></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)._~3c~3d/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._~3c~3d%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x"><=/c</a></span></span><span class="hspace"> </span><span class="RktVar">n</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3c%2Fc%29%29" class="RktValLink" data-pltdoc="x"></c</a></span>, but for <span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._~3c~3d%29%29" class="RktValLink" data-pltdoc="x"><=</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)._~3e~3d/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._~3e~3d%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">>=/c</a></span></span><span class="hspace"> </span><span class="RktVar">n</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Like <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3c%2Fc%29%29" class="RktValLink" data-pltdoc="x"></c</a></span>, but for <span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._~3e~3d%29%29" class="RktValLink" data-pltdoc="x">>=</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)._between/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._between%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">between/c</a></span></span><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span><span class="RktVar">m</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">m</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span></td></tr></table></blockquote></div><div class="SIntrapara"> Returns a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that requires the
input to be a real number between <span class="RktVar">n</span> and <span class="RktVar">m</span> or equal to
one of them.</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)._real-in))"></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._real-in%29%29" class="RktValDef RktValLink" data-pltdoc="x">real-in</a></span></span><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span><span class="RktVar">m</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">m</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">An alias for <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._between%2Fc%29%29" class="RktValLink" data-pltdoc="x">between/c</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/base..rkt)._integer-in))"></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._integer-in%29%29" class="RktValDef RktValLink" data-pltdoc="x">integer-in</a></span></span><span class="hspace"> </span><span class="RktVar">j</span><span class="hspace"> </span><span class="RktVar">k</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">j</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-integer?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">k</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-integer?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that requires the input to be an exact integer
between <span class="RktVar">j</span> and <span class="RktVar">k</span>, inclusive.</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)._char-in))"></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._char-in%29%29" class="RktValDef RktValLink" data-pltdoc="x">char-in</a></span></span><span class="hspace"> </span><span class="RktVar">a</span><span class="hspace"> </span><span class="RktVar">b</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">a</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="characters.html#%28def._%28%28quote._~23~25kernel%29._char~3f%29%29" class="RktValLink" data-pltdoc="x">char?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">b</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="characters.html#%28def._%28%28quote._~23~25kernel%29._char~3f%29%29" class="RktValLink" data-pltdoc="x">char?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that requires the input to be a character whose
code point number is between the code point numbers of <span class="RktVar">a</span> and
<span class="RktVar">b</span>, inclusive.</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>value</p></div></div><p class="RForeground"><a name="(def._((lib._racket/contract/private/misc..rkt)._natural-number/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._natural-number%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">natural-number/c</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that requires the input to be an exact non-negative integer.</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)._string-len/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._string-len%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">string-len/c</a></span></span><span class="hspace"> </span><span class="RktVar">len</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">len</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that recognizes strings that have fewer than
<span class="RktVar">len</span> characters.</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>value</p></div></div><p class="RForeground"><a name="(def._((lib._racket/contract/private/misc..rkt)._false/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._false%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">false/c</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">An alias for <span class="RktVal">#f</span> for backwards compatibility.</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>value</p></div></div><p class="RForeground"><a name="(def._((lib._racket/contract/private/misc..rkt)._printable/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._printable%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">printable/c</a></span></span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that recognizes values that can be written out and
read back in with <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._write%29%29" class="RktValLink" data-pltdoc="x">write</a></span> and <span class="RktSym"><a href="Reading.html#%28def._%28%28quote._~23~25kernel%29._read%29%29" class="RktValLink" data-pltdoc="x">read</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/base..rkt)._one-of/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._one-of%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">one-of/c</a></span></span><span class="hspace"> </span><span class="RktVar">v</span><span class="hspace"> </span><span class="RktMeta">...+</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</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="#%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">Accepts any number of atomic values and returns a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that
recognizes those values, using <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eqv~3f%29%29" class="RktValLink" data-pltdoc="x">eqv?</a></span> as the comparison
predicate. For the purposes of <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._one-of%2Fc%29%29" class="RktValLink" data-pltdoc="x">one-of/c</a></span>, atomic values are
defined to be: <a href="characters.html#%28tech._character%29" class="techoutside" data-pltdoc="x"><span class="techinside">characters</span></a>, <a href="symbols.html#%28tech._symbol%29" class="techoutside" data-pltdoc="x"><span class="techinside">symbols</span></a>, <a href="booleans.html#%28tech._boolean%29" class="techoutside" data-pltdoc="x"><span class="techinside">booleans</span></a>,
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._null%29%29" class="RktValLink" data-pltdoc="x">null</a></span>, <a href="keywords.html#%28tech._keyword%29" class="techoutside" data-pltdoc="x"><span class="techinside">keywords</span></a>, <a href="numbers.html#%28tech._number%29" class="techoutside" data-pltdoc="x"><span class="techinside">numbers</span></a>,
<a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&rel=void_undefined.html&version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="nobreak"><span class="RktRes">#<void></span></span></a>, and <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&rel=void_undefined.html&version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="nobreak"><span class="RktRes">#<undefined></span></span></a>.</div></p><p>This is a backwards compatibility contract constructor. If
neither <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&rel=void_undefined.html&version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="nobreak"><span class="RktRes">#<void></span></span></a> nor <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=guide&rel=void_undefined.html&version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="nobreak"><span class="RktRes">#<undefined></span></span></a> are arguments,
it simply passes its arguments to <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</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/base..rkt)._symbols))"></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._symbols%29%29" class="RktValDef RktValLink" data-pltdoc="x">symbols</a></span></span><span class="hspace"> </span><span class="RktVar">sym</span><span class="hspace"> </span><span class="RktMeta">...+</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">sym</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Accepts any number of symbols and returns a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that
recognizes those symbols.</div></p><p>This is a backwards compatibility constructor; it merely
passes its arguments to <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</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><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td valign="top"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/vector..rkt)._vectorof))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fvector..rkt%29._vectorof%29%29" class="RktValDef RktValLink" data-pltdoc="x">vectorof</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="RktPn">#:immutable</span><span class="hspace"> </span><span class="RktVar">immutable</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="RktPn">#:flat?</span><span class="hspace"> </span><span class="RktVar">flat?</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="contract-utilities.html#%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></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="contract-utilities.html#%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">immutable</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%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">#t</span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">dont-care</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">dont-care</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">flat?</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><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contract</span></a> that recognizes vectors. The elements of the vector must
match <span class="RktVar">c</span>.</div></p><p>If the <span class="RktVar">flat?</span> argument is <span class="RktVal">#t</span>, then 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>, and the <span class="RktVar">c</span> argument must also be a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>. Such
<a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a> will be unsound if applied to mutable vectors, as they will not
check future operations on the vector.</p><p>If the <span class="RktVar">immutable</span> argument is <span class="RktVal">#t</span> and the <span class="RktVar">c</span> argument is
a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>, the result will be a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>. If the <span class="RktVar">c</span> argument
is a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a>, then the result will be a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a>.</p><p>When a higher-order <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fvector..rkt%29._vectorof%29%29" class="RktValLink" data-pltdoc="x">vectorof</a></span> contract is applied to a vector, the result
is not <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> to the input. The result will be a copy for immutable vectors
and a <a href="chaperones.html#%28tech._chaperone%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone</span></a> or <a href="chaperones.html#%28tech._impersonator%29" class="techoutside" data-pltdoc="x"><span class="techinside">impersonator</span></a> of the input for mutable vectors,
unless the <span class="RktVar">c</span> argument is a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> and the vector is immutable,
in which case the result is the original vector.</p><p class="SHistory">Changed in version 6.3.0.5 of package <span class="stt">base</span>: Changed flat vector contracts to not copy
immutable vectors.</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/vector..rkt)._vector-immutableof))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fvector..rkt%29._vector-immutableof%29%29" class="RktValDef RktValLink" data-pltdoc="x">vector-immutableof</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="contract-utilities.html#%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">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">Returns the same <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contract</span></a> as <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fvector..rkt%29._vectorof%29%29" class="RktValLink" data-pltdoc="x">vectorof</a></span><span class="stt"> </span><span class="RktVar">c</span><span class="stt"> </span><span class="RktPn">#:immutable</span><span class="stt"> </span><span class="RktVal">#t</span><span class="RktPn">)</span>. This form exists for
backwards compatibility.</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/vector..rkt)._vector/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%2Fvector..rkt%29._vector%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">vector/c</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="RktMeta">...</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="RktPn">#:immutable</span><span class="hspace"> </span><span class="RktVar">immutable</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="RktPn">#:flat?</span><span class="hspace"> </span><span class="RktVar">flat?</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="contract-utilities.html#%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></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="contract-utilities.html#%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">immutable</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%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">#t</span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">dont-care</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">dont-care</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">flat?</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><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a <a href="contracts.html#%28tech._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">contract</span></a> that recognizes vectors whose lengths match the number of
contracts given. Each element of the vector must match its corresponding contract.</div></p><p>If the <span class="RktVar">flat?</span> argument is <span class="RktVal">#t</span>, then 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>, and the <span class="RktVar">c</span> arguments must also be <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>. Such
<a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a> will be unsound if applied to mutable vectors, as they will not
check future operations on the vector.</p><p>If the <span class="RktVar">immutable</span> argument is <span class="RktVal">#t</span> and the <span class="RktVar">c</span> arguments are
<a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>, the result will be a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>. If the <span class="RktVar">c</span> arguments
are <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contracts</span></a>, then the result will be a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a>.</p><p>When a higher-order <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fvector..rkt%29._vector%2Fc%29%29" class="RktValLink" data-pltdoc="x">vector/c</a></span> contract is applied to a vector, the result
is not <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> to the input. The result will be a copy for immutable vectors
and a <a href="chaperones.html#%28tech._chaperone%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone</span></a> or <a href="chaperones.html#%28tech._impersonator%29" class="techoutside" data-pltdoc="x"><span class="techinside">impersonator</span></a> of the input for mutable vectors.</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/vector..rkt)._vector-immutable/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%2Fvector..rkt%29._vector-immutable%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">vector-immutable/c</a></span></span><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">Returns the same contract as <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fvector..rkt%29._vector%2Fc%29%29" class="RktValLink" data-pltdoc="x">vector/c</a></span><span class="stt"> </span><span class="RktVar">c</span><span class="stt"> </span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._......%29%29" class="RktStxLink" data-pltdoc="x">...</a></span><span class="stt"> </span><span class="RktPn">#:immutable</span><span class="stt"> </span><span class="RktVal">#t</span><span class="RktPn">)</span>. This form exists for
reasons of backwards compatibility.</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/box..rkt)._box/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%2Fbox..rkt%29._box%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">box/c</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">in-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">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="RktPn">#:immutable</span><span class="hspace"> </span><span class="RktVar">immutable</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="RktPn">#:flat?</span><span class="hspace"> </span><span class="RktVar">flat?</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="contract-utilities.html#%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></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">in-c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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="hspace"> </span><span class="RktVar">in-c</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">immutable</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%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">#t</span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">dont-care</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">dont-care</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">flat?</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><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a contract that recognizes boxes. The content of the box must match <span class="RktVar">c</span>,
and mutations on mutable boxes must match <span class="RktVar">in-c</span>.</div></p><p>If the <span class="RktVar">flat?</span> argument is <span class="RktVal">#t</span>, then 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>, and the <span class="RktSym">out</span> argument must also be a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>. Such
<a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a> will be unsound if applied to mutable boxes, as they will not check
future operations on the box.</p><p>If the <span class="RktVar">immutable</span> argument is <span class="RktVal">#t</span> and the <span class="RktVar">c</span> argument is
a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>, the result will be a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>. If the <span class="RktVar">c</span> argument is
a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a>, then the result will be a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a>.</p><p>When a higher-order <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fbox..rkt%29._box%2Fc%29%29" class="RktValLink" data-pltdoc="x">box/c</a></span> contract is applied to a box, the result
is not <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> to the input. The result will be a copy for immutable boxes
and either a <a href="chaperones.html#%28tech._chaperone%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone</span></a> or <a href="chaperones.html#%28tech._impersonator%29" class="techoutside" data-pltdoc="x"><span class="techinside">impersonator</span></a> of the input for mutable boxes.</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/box..rkt)._box-immutable/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%2Fbox..rkt%29._box-immutable%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">box-immutable/c</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="contract-utilities.html#%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">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">Returns the same contract as <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fbox..rkt%29._box%2Fc%29%29" class="RktValLink" data-pltdoc="x">box/c</a></span><span class="stt"> </span><span class="RktVar">c</span><span class="stt"> </span><span class="RktPn">#:immutable</span><span class="stt"> </span><span class="RktVal">#t</span><span class="RktPn">)</span>. This form exists for
reasons of backwards compatibility.</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/base..rkt)._listof))"></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._listof%29%29" class="RktValDef RktValLink" data-pltdoc="x">listof</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="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValLink" data-pltdoc="x">list-contract?</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="contract-utilities.html#%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">Returns a contract that recognizes a list whose every element matches
the contract <span class="RktVar">c</span>. Beware that when this contract is applied to
a value, the result is not necessarily <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> to the input.</div></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="RktSym">some-numbers</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></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="pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29" class="RktValLink" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">2</span><span class="hspace"> </span><span class="RktVal">3</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">just-one-number</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">11</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">just-one-number: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: list?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: 11</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: (listof number?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (definition just-one-number)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition just-one-number)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:3.0</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/base..rkt)._non-empty-listof))"></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._non-empty-listof%29%29" class="RktValDef RktValLink" data-pltdoc="x">non-empty-listof</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="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValLink" data-pltdoc="x">list-contract?</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="contract-utilities.html#%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">Returns a contract that recognizes non-empty lists whose elements match
the contract <span class="RktVar">c</span>. Beware that when this contract is applied to
a value, the result is not necessarily <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> to the input.</div></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="RktSym">some-numbers</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._non-empty-listof%29%29" class="RktValLink" data-pltdoc="x">non-empty-listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></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="pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29" class="RktValLink" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">2</span><span class="hspace"> </span><span class="RktVal">3</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">not-enough-numbers</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._non-empty-listof%29%29" class="RktValLink" data-pltdoc="x">non-empty-listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></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="pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29" class="RktValLink" data-pltdoc="x">list</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">not-enough-numbers: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: "(and/c list? pair?)"</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: '()</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: (non-empty-listof number?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: </span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(definition not-enough-numbers)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition not-enough-numbers)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:3.0</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/base..rkt)._list*of))"></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._list%2Aof%29%29" class="RktValDef RktValLink" data-pltdoc="x">list*of</a></span></span><span class="hspace"> </span><span class="RktVar">ele-c</span><span class="hspace"> </span>[<span class="RktVar">last-c</span>]<span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">ele-c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">last-c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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="hspace"> </span><span class="RktVar">ele-c</span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a contract that recognizes improper lists whose elements match
the contract <span class="RktVar">ele-c</span> and whose last position matches <span class="RktVar">last-c</span>.
If an improper list is created 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>,
then its <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span> position is expected to match <span class="RktVar">ele-c</span> and
its <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cdr%29%29" class="RktValLink" data-pltdoc="x">cdr</a></span> position is expected to be <span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._list%2Aof%29%29" class="RktValLink" data-pltdoc="x">list*of</a></span><span class="stt"> </span><span class="RktVar">ele-c</span><span class="stt"> </span><span class="RktSym">list-c</span><span class="RktPn">)</span>. Otherwise,
it is expected to match <span class="RktVar">last-c</span>. Beware that when this contract is applied to
a value, the result is not necessarily <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> to the input.</div></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="RktSym">improper-numbers</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._list%2Aof%29%29" class="RktValLink" data-pltdoc="x">list*of</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></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="pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktVal">2</span><span class="hspace"> </span><span class="RktVal">3</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">not-improper-numbers</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._list%2Aof%29%29" class="RktValLink" data-pltdoc="x">list*of</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></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="pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29" class="RktValLink" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">2</span><span class="hspace"> </span><span class="RktVal">3</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">not-improper-numbers: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: number?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: '()</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: an element of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(list*of number?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: </span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(definition not-improper-numbers)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition not-improper-numbers)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:3.0</span></p></td></tr></table></blockquote></div></p><p class="SHistory">Added in version 6.1.1.1 of package <span class="stt">base</span>. Changed in version 6.4.0.4: Added the <span class="RktVar">last-c</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/base..rkt)._cons/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._cons%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">cons/c</a></span></span><span class="hspace"> </span><span class="RktVar">car-c</span><span class="hspace"> </span><span class="RktVar">cdr-c</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">car-c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">cdr-c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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 recognizes pairs whose first and second elements
match <span class="RktVar">car-c</span> and <span class="RktVar">cdr-c</span>, respectively. Beware that
when this contract is applied to a value, the result is not
necessarily <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> to the input.</div></p><p>If the <span class="RktVar">cdr-c</span> contract is a <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValLink" data-pltdoc="x">list-contract?</a></span>, then
<span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._cons%2Fc%29%29" class="RktValLink" data-pltdoc="x">cons/c</a></span> returns a <span class="RktSym"><a href="contract-utilities.html#%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><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="RktSym">a-pair-of-numbers</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._cons%2Fc%29%29" class="RktValLink" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></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="pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">not-a-pair-of-numbers</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._cons%2Fc%29%29" class="RktValLink" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></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="pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">not-a-pair-of-numbers: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: number?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: #f</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: the car of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(cons/c number? number?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: </span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(definition not-a-pair-of-numbers)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition not-a-pair-of-numbers)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:3.0</span></p></td></tr></table></blockquote></div></p><p class="SHistory">Changed in version 6.0.1.13 of package <span class="stt">base</span>: Added the <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValLink" data-pltdoc="x">list-contract?</a></span> propagating behavior.</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/base..rkt)._cons/dc))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._cons%2Fdc%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">cons/dc</a></span></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktVar">car-id</span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktVar">cdr-id</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">car-id</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktVar">cons/dc-option</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%2Fbase..rkt%29._cons%2Fdc%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">cons/dc</a></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktVar">car-id</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">cdr-id</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktVar">cdr-id</span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktVar">cons/dc-option</span><span class="RktPn">)</span></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">cons/dc-option</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">#:flat</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:chaperone</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:impersonator</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Produces a contract that recognizes pairs whose first and second elements
match the expressions after <span class="RktVar">car-id</span> and <span class="RktVar">cdr-id</span>, respectively.</div></p><p>In the first case, the contract on the <span class="RktVar">cdr-id</span> portion of the contract
may depend on the value in the <span class="RktVar">car-id</span> portion of the pair and in
the second case, the reverse is true.</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="RktSym">an-ordered-pair-of-reals</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%2Fbase..rkt%29._cons%2Fdc%29%29" class="RktStxLink" data-pltdoc="x">cons/dc</a></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">hd</span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">tl</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">hd</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3e~3d%2Fc%29%29" class="RktValLink" data-pltdoc="x">>=/c</a></span><span class="hspace"> </span><span class="RktSym">hd</span><span class="RktPn">)</span><span class="RktPn">]</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="pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">not-an-ordered-pair-of-reals</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%2Fbase..rkt%29._cons%2Fdc%29%29" class="RktStxLink" data-pltdoc="x">cons/dc</a></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">hd</span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">tl</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">hd</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3e~3d%2Fc%29%29" class="RktValLink" data-pltdoc="x">>=/c</a></span><span class="hspace"> </span><span class="RktSym">hd</span><span class="RktPn">)</span><span class="RktPn">]</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="pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktVal">2</span><span class="hspace"> </span><span class="RktVal">1</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">not-an-ordered-pair-of-reals: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: (>=/c 2)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: 1</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: the cdr of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(cons/dc (hd real?) (tl (hd) (>=/c hd)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: </span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(definition not-an-ordered-pair-of-reals)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition not-an-ordered-pair-of-reals)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:3.0</span></p></td></tr></table></blockquote></div></p><p class="SHistory">Added in version 6.1.1.6 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/base..rkt)._list/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._list%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">list/c</a></span></span><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValLink" data-pltdoc="x">list-contract?</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="contract-utilities.html#%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 for a list. The number of elements in the list
must match the number of arguments supplied to <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._list%2Fc%29%29" class="RktValLink" data-pltdoc="x">list/c</a></span>, and
each element of the list must match the corresponding contract. Beware
that when this contract is applied to a value, the result is not
necessarily <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> to the input.</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/base..rkt)._*list/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._%2Alist%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">*list/c</a></span></span><span class="hspace"> </span><span class="RktVar">prefix</span><span class="hspace"> </span><span class="RktVar">suffix</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._list-contract~3f%29%29" class="RktValLink" data-pltdoc="x">list-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">prefix</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">suffix</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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 for a list. The number of elements in the list
must be at least as long as the number of <span class="RktVar">suffix</span> contracts
and the tail of the list must match those contracts, one for each
element. The beginning portion of the list can be arbitrarily long,
and each element must match <span class="RktVar">prefix</span>.</div></p><p>Beware that when this contract is applied to a value, the result is not
necessarily <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> to the input.</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="RktSym">a-list-of-numbers-ending-with-two-integers</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._%2Alist%2Fc%29%29" class="RktValLink" data-pltdoc="x">*list/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></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="pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29" class="RktValLink" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">1/2</span><span class="hspace"> </span><span class="RktVal">4/5</span><span class="hspace"> </span><span class="RktVal">0+1i</span><span class="hspace"> </span><span class="RktVal"><span class="nobreak">-1</span>1</span><span class="hspace"> </span><span class="RktVal">322</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">not-enough-integers-at-the-end</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._%2Alist%2Fc%29%29" class="RktValLink" data-pltdoc="x">*list/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></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="pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29" class="RktValLink" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">1/2</span><span class="hspace"> </span><span class="RktVal">4/5</span><span class="hspace"> </span><span class="RktVal">1/2</span><span class="hspace"> </span><span class="RktVal">321</span><span class="hspace"> </span><span class="RktVal">322</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">not-enough-integers-at-the-end: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: integer?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: 1/2</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: the 3rd to the last element of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(*list/c number? integer? integer? integer?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: </span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(definition not-enough-integers-at-the-end)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition not-enough-integers-at-the-end)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:3.0</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/misc..rkt)._syntax/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._syntax%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">syntax/c</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="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</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="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that recognizes syntax objects whose
<span class="RktSym"><a href="stxops.html#%28def._%28%28quote._~23~25kernel%29._syntax-e%29%29" class="RktValLink" data-pltdoc="x">syntax-e</a></span> content matches <span class="RktVar">c</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>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/contract/private/struct-dc..rkt)._struct/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%2Fstruct-dc..rkt%29._struct%2Fc%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">struct/c</a></span></span><span class="hspace"> </span><span class="RktVar">struct-id</span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Produces a contract that recognizes instances of the structure
type named by <span class="RktVar">struct-id</span>, and whose field values match the
contracts produced by the <span class="RktVar">contract-expr</span>s.</div></p><p>Contracts for immutable fields must be either flat or <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contracts</span></a>.
Contracts for mutable fields may be impersonator contracts.
If all fields are immutable and the <span class="RktVar">contract-expr</span>s evaluate
to <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>, a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> is produced. If all the
<span class="RktVar">contract-expr</span>s are <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contracts</span></a>, a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a> is
produced. Otherwise, an impersonator contract is produced.</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/struct-dc..rkt)._struct/dc))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fstruct-dc..rkt%29._struct%2Fdc%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">struct/dc</a></span></span><span class="hspace"> </span><span class="RktVar">struct-id</span><span class="hspace"> </span><span class="RktVar">field-spec</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="hspace"> </span><span class="RktVar">maybe-inv</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">field-spec</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">[</span><span class="RktVar">field-name</span><span class="hspace"> </span><span class="RktVar">maybe-lazy</span><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="RktPn">]</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">[</span><span class="RktVar">field-name</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">dep-field-name</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">maybe-lazy</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">maybe-contract-type</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">maybe-dep-state</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">contract-expr</span><span class="RktPn">]</span></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"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">field-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"><span class="RktVar">field-id</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktPn">#:selector</span><span class="hspace"> </span><span class="RktVar">selector-id</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktVar">field-id</span><span class="hspace"> </span><span class="RktPn">#:parent</span><span class="hspace"> </span><span class="RktVar">struct-id</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">maybe-lazy</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">#:lazy</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">maybe-contract-type</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">#:flat</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:chaperone</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:impersonator</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">maybe-dep-state</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">#:depends-on-state</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">maybe-inv</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">#:inv</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">dep-field-name</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">invariant-expr</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Produces a contract that recognizes instances of the structure
type named by <span class="RktVar">struct-id</span>, and whose field values match the
contracts produced by the <span class="RktVar">field-spec</span>s.</div></p><p>If the <span class="RktVar">field-spec</span> lists the names of other fields,
then the contract depends on values in those fields, and the <span class="RktVar">contract-expr</span>
expression is evaluated each time a selector is applied, building a new contract
for the fields based on the values of the <span class="RktVar">dep-field-name</span> fields (the
<span class="RktVar">dep-field-name</span> syntax is the same as the <span class="RktVar">field-name</span> syntax).
If the field is a dependent field and no <span class="RktSym">contract-type</span> annotation
appears, then it is assumed that the contract is
a chaperone, but not always a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> (and thus the entire <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fstruct-dc..rkt%29._struct%2Fdc%29%29" class="RktStxLink" data-pltdoc="x">struct/dc</a></span>
contract is not a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>).
If this is not the case, and the contract is
always flat then the field must be annotated with
the <span class="RktPn">#:flat</span>, or the field must be annotated with
<span class="RktPn">#:impersonator</span> (in which case, it must be a mutable field).</p><p>A <span class="RktVar">field-name</span> is either an identifier naming a field in the first
case, an identifier naming a selector in the second case indicated
by the <span class="RktPn">#:selector</span> keyword, or
a field id for a struct that is a parent of <span class="RktVar">struct-id</span>, indicated
by the <span class="RktPn">#:parent</span> keyword.</p><p>If the <span class="RktPn">#:lazy</span> keyword appears, then the contract
on the field is checked lazily (only when a selector is applied);
<span class="RktPn">#:lazy</span> contracts cannot be put on mutable fields.</p><p>If a dependent contract depends on some mutable state, then use the
<span class="RktPn">#:depends-on-state</span> keyword argument (if a field’s dependent contract
depends on a mutable field, this keyword is automatically inferred).
The presence of this keyword means that the contract expression is evaluated
each time the corresponding field is accessed (or mutated, if it is a mutable
field). Otherwise, the contract expression for a dependent field contract
is evaluated when the contract is applied to a value.</p><p>If the <span class="RktPn">#:inv</span> clause appears, then the invariant expression is
evaluated (and must return a non-<span class="RktVal">#f</span> value) when the contract
is applied to a struct.</p><p>Contracts for immutable fields must be either flat or <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contracts</span></a>.
Contracts for mutable fields may be impersonator contracts.
If all fields are immutable and the <span class="RktVar">contract-expr</span>s evaluate
to <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>, a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> is produced. If all the
<span class="RktVar">contract-expr</span>s are <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contracts</span></a>, a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a> is
produced. Otherwise, an impersonator contract is produced.</p><p>As an example, the function <span class="RktSym">bst/c</span> below
returns a contract for binary search trees whose values
are all between <span class="RktSym">lo</span> and <span class="RktSym">hi</span>.
The lazy annotations ensure that this contract does not
change the running time of operations that do not
inspect the entire tree.</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define-struct.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._struct%29%29" class="RktStxLink" data-pltdoc="x">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="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">bst/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="#%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></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fstruct-dc..rkt%29._struct%2Fdc%29%29" class="RktStxLink" data-pltdoc="x">struct/dc</a></span><span class="hspace"> </span><span class="RktSym">bt</span></td></tr><tr><td><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="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._between%2Fc%29%29" class="RktValLink" data-pltdoc="x">between/c</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">#:lazy</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">bst</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">#:lazy</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">bst</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></table></blockquote><p class="SHistory">Changed in version 6.0.1.6 of package <span class="stt">base</span>: Added <span class="RktPn">#:inv</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)._parameter/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._parameter%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">parameter/c</a></span></span><span class="hspace"> </span><span class="RktVar">in</span><span class="hspace"> </span>[<span class="RktVar">out</span>]<span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">in</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">out</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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="hspace"> </span><span class="RktVar">in</span></td></tr></table></blockquote></div><div class="SIntrapara">Produces a contract on parameters whose values must match
<span class="RktVar">out</span>. When the value in the contracted parameter
is set, it must match <span class="RktVar">in</span>.</div></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="RktSym">current-snack</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._parameter%2Fc%29%29" class="RktValLink" data-pltdoc="x">parameter/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></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="parameters.html#%28def._%28%28quote._~23~25kernel%29._make-parameter%29%29" class="RktValLink" data-pltdoc="x">make-parameter</a></span><span class="hspace"> </span><span class="RktVal">"potato-chip"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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">baked/c</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._flat-named-contract%29%29" class="RktValLink" data-pltdoc="x">flat-named-contract</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">baked/c</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">λ</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="regexp.html#%28def._%28%28quote._~23~25kernel%29._regexp-match%29%29" class="RktValLink" data-pltdoc="x">regexp-match</a></span><span class="hspace"> </span><span class="RktVal">#rx"baked"</span><span class="hspace"> </span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">current-dinner</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._parameter%2Fc%29%29" class="RktValLink" data-pltdoc="x">parameter/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym">baked/c</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="parameters.html#%28def._%28%28quote._~23~25kernel%29._make-parameter%29%29" class="RktValLink" data-pltdoc="x">make-parameter</a></span><span class="hspace"> </span><span class="RktVal">"turkey"</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">λ</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string-append%29%29" class="RktValLink" data-pltdoc="x">string-append</a></span><span class="hspace"> </span><span class="RktVal">"roasted "</span><span class="hspace"> </span><span class="RktSym">s</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">current-snack</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">not-a-snack</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">current-snack: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">expected: string?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">given: 'not-a-snack</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: the parameter of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(parameter/c string?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (definition current-snack)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:2.0</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="parameters.html#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._parameterize%29%29" class="RktStxLink" data-pltdoc="x">parameterize</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">current-dinner</span><span class="hspace"> </span><span class="RktVal">"tofurkey"</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">current-dinner</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">current-dinner: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: baked/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: "roasted tofurkey"</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: the parameter of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(parameter/c string? baked/c)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (definition current-dinner)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition current-dinner)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:4.0</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/misc..rkt)._procedure-arity-includes/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._procedure-arity-includes%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">procedure-arity-includes/c</a></span></span><span class="hspace"> </span><span class="RktVar">n</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">n</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._exact-nonnegative-integer~3f%29%29" class="RktValLink" data-pltdoc="x">exact-nonnegative-integer?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Produces a contract for procedures that accept <span class="RktVar">n</span> argument
(i.e,. the <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> contract is implied).</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/hash..rkt)._hash/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%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">hash/c</a></span></span></td><td valign="top"><span class="hspace"> </span></td><td valign="top"><span class="RktVar">key</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">val</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="RktPn">#:immutable</span><span class="hspace"> </span><span class="RktVar">immutable</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="RktPn">#:flat?</span><span class="hspace"> </span><span class="RktVar">flat?</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="contract-utilities.html#%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></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">key</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._chaperone-contract~3f%29%29" class="RktValLink" data-pltdoc="x">chaperone-contract?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">val</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">immutable</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%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">#t</span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">dont-care</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">dont-care</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">flat?</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><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Produces a contract that recognizes <span class="RktSym"><a href="hashtables.html#%28def._%28%28quote._~23~25kernel%29._hash%29%29" class="RktValLink" data-pltdoc="x">hash</a></span> tables with keys and values
as specified by the <span class="RktVar">key</span> and <span class="RktVar">val</span> arguments.</div></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="RktSym">good-hash</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></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><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="hashtables.html#%28def._%28%28quote._~23~25kernel%29._hash%29%29" class="RktValLink" data-pltdoc="x">hash</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">#t</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">2</span><span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">3</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">bad-hash</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></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><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="hashtables.html#%28def._%28%28quote._~23~25kernel%29._hash%29%29" class="RktValLink" data-pltdoc="x">hash</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">"elephant"</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">2</span><span class="hspace"> </span><span class="RktVal">"monkey"</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">3</span><span class="hspace"> </span><span class="RktVal">"manatee"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">bad-hash: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: boolean?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: "elephant"</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: the values of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(hash/c integer? boolean?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (definition bad-hash)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition bad-hash)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:3.0</span></p></td></tr></table></blockquote></div></p><p><div class="SIntrapara">There are a number of technicalities that control how <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/c</a></span> contracts
behave.
</div><div class="SIntrapara"><ul><li><p>If the <span class="RktVar">flat?</span> argument is <span class="RktVal">#t</span>, then 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>, and the <span class="RktVar">key</span> and <span class="RktVar">val</span> arguments must also be
<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">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></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><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#f</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></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><span class="hspace"> </span><span class="RktPn">#:flat?</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</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="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">#:flat?</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">hash/c: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">expected: flat-contract?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">given: (-> integer? integer?)</span></p></td></tr></table></blockquote></div></p><p>Such <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a> will be unsound if applied to mutable hash tables,
as they will not check future mutations to the hash table.</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">original-h</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="hashtables.html#%28def._%28%28quote._~23~25kernel%29._make-hasheq%29%29" class="RktValLink" data-pltdoc="x">make-hasheq</a></span><span class="RktPn">)</span><span class="RktPn">)</span></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="RktSym">ctc-h</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></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><span class="hspace"> </span><span class="RktPn">#:flat?</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktSym">original-h</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="hashtables.html#%28def._%28%28quote._~23~25kernel%29._hash-set%21%29%29" class="RktValLink" data-pltdoc="x">hash-set!</a></span><span class="hspace"> </span><span class="RktSym">original-h</span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">"not a boolean"</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><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><span class="hspace"> </span><span class="RktSym">ctc-h</span><span class="hspace"> </span><span class="RktVal">1</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"not a boolean"</span></p></td></tr></table></blockquote></div></p></li><li><p>If the <span class="RktVar">immutable</span> argument is <span class="RktVal">#t</span> and the <span class="RktVar">key</span> and
<span class="RktVar">val</span> arguments are <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span>s, the result will be a
<span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span>.</p><p><div class="SIntrapara">Example:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></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><span class="hspace"> </span><span class="RktPn">#:immutable</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr></table></blockquote></div></p><p>If either the domain or the range is a <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._chaperone-contract~3f%29%29" class="RktValLink" data-pltdoc="x">chaperone-contract?</a></span>, then the result will
be a <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._chaperone-contract~3f%29%29" class="RktValLink" data-pltdoc="x">chaperone-contract?</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="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/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="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="RktPn">)</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></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">#:immutable</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">#f</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="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._chaperone-contract~3f%29%29" class="RktValLink" data-pltdoc="x">chaperone-contract?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/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="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="RktPn">)</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></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">#:immutable</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr></table></blockquote></div></p></li><li><p><div class="SIntrapara">If the <span class="RktVar">key</span> argument is a <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._chaperone-contract~3f%29%29" class="RktValLink" data-pltdoc="x">chaperone-contract?</a></span> but not a
<span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span>, then the resulting contract
can be applied only to <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._equal~3f%29%29" class="RktValLink" data-pltdoc="x">equal?</a></span>-based hash tables.
</div><div class="SIntrapara"><p><div class="SIntrapara">Example:</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="RktSym">h</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/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="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._integer~3f%29%29" class="RktValLink" data-pltdoc="x">integer?</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym"><a href="#%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="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="hashtables.html#%28def._%28%28quote._~23~25kernel%29._make-hasheq%29%29" class="RktValLink" data-pltdoc="x">make-hasheq</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">h: broke its own contract;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised equal?-based hash table due to higher-order domain</span></p></td></tr><tr><td><p><span class="RktErr">contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: '#hasheq()</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: (hash/c (-> integer? integer?) any/c)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (definition h)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition h)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:2.0</span></p></td></tr></table></blockquote></div></p></div><div class="SIntrapara">Also, when such a <span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fc%29%29" class="RktValLink" data-pltdoc="x">hash/c</a></span> contract is applied to a hash table, the result is not
<span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span>
to the input. The result of applying the contract will be a copy for immutable hash tables,
and either a <a href="chaperones.html#%28tech._chaperone%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone</span></a> or <a href="chaperones.html#%28tech._impersonator%29" class="techoutside" data-pltdoc="x"><span class="techinside">impersonator</span></a> of the original hash table
for mutable hash tables.</div></p></li></ul></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><table cellspacing="0" cellpadding="0" class="RktBlk RForeground"><tr><td><span class="RktPn">(</span><a name="(form._((lib._racket/contract/private/hash..rkt)._hash/dc))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fhash..rkt%29._hash%2Fdc%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">hash/dc</a></span></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktVar">key-id</span><span class="hspace"> </span><span class="RktVar">key-contract-expr</span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktVar">value-id</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">key-id</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">value-contract-expr</span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">hash/dc-option</span><span class="RktPn">)</span></td></tr></table></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">hash/dc-option</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">#:immutable</span><span class="hspace"> </span><span class="RktVar">immutable?-expr</span><span class="hspace"> </span><span class="RktVar">hash/dc-option</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:kind</span><span class="hspace"> </span><span class="RktVar">kind-expr</span><span class="hspace"> </span><span class="RktVar">hash/dc-option</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Creates a contract for <span class="RktSym"><a href="hashtables.html#%28def._%28%28quote._~23~25kernel%29._hash~3f%29%29" class="RktValLink" data-pltdoc="x">hash?</a></span> tables with keys matching <span class="RktVar">key-contract-expr</span>
and where the contract on the values can depend on the key itself, since
<span class="RktVar">key-id</span> will be bound to the corresponding key before evaluating
the <span class="RktSym">values-contract-expr</span>.</div></p><p>If <span class="RktVar">immutable?-expr</span> is <span class="RktVal">#t</span>, then only <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._immutable~3f%29%29" class="RktValLink" data-pltdoc="x">immutable?</a></span> hashes
are accepted. If it is <span class="RktVal">#f</span> then <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._immutable~3f%29%29" class="RktValLink" data-pltdoc="x">immutable?</a></span> hashes are always
rejected. It defaults to <span class="RktVal">'</span><span class="RktVal">dont-care</span>, in which case both mutable and
immutable hashes are accepted.</p><p>If <span class="RktVar">kind-expr</span> evaluates to <span class="RktVal">'</span><span class="RktVal">flat</span>, then <span class="RktVar">key-contract-expr</span>
and <span class="RktVar">value-contract-expr</span> are expected to evaluate to <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span>s.
If it is <span class="RktVal">'</span><span class="RktVal">chaperone</span>, then they are expected to be <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._chaperone-contract~3f%29%29" class="RktValLink" data-pltdoc="x">chaperone-contract?</a></span>s,
and it may also be <span class="RktVal">'</span><span class="RktVal">impersonator</span>, in which case they may be any <span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span>s.
The default is <span class="RktVal">'</span><span class="RktVal">chaperone</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="RktSym">h</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%2Fhash..rkt%29._hash%2Fdc%29%29" class="RktStxLink" data-pltdoc="x">hash/dc</a></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">k</span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">v</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3e~3d%2Fc%29%29" class="RktValLink" data-pltdoc="x">>=/c</a></span><span class="hspace"> </span><span class="RktSym">k</span><span class="RktPn">)</span><span class="RktPn">]</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="hashtables.html#%28def._%28%28quote._~23~25kernel%29._hash%29%29" class="RktValLink" data-pltdoc="x">hash</a></span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">3</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">2</span><span class="hspace"> </span><span class="RktVal">4</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">h</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%2Fhash..rkt%29._hash%2Fdc%29%29" class="RktStxLink" data-pltdoc="x">hash/dc</a></span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">k</span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._real~3f%29%29" class="RktValLink" data-pltdoc="x">real?</a></span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym">v</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3e~3d%2Fc%29%29" class="RktValLink" data-pltdoc="x">>=/c</a></span><span class="hspace"> </span><span class="RktSym">k</span><span class="RktPn">)</span><span class="RktPn">]</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="hashtables.html#%28def._%28%28quote._~23~25kernel%29._hash%29%29" class="RktValLink" data-pltdoc="x">hash</a></span><span class="hspace"> </span><span class="RktVal">3</span><span class="hspace"> </span><span class="RktVal">1</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">4</span><span class="hspace"> </span><span class="RktVal">2</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">h: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: (>=/c 3)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: 1</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: the values of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(hash/dc (k real?) (v (k) (>=/c k)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (definition h)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition h)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:3.0</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/misc..rkt)._channel/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._channel%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">channel/c</a></span></span><span class="hspace"> </span><span class="RktVar">val</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">val</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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 recognizes <a href="channel.html#%28tech._channel%29" class="techoutside" data-pltdoc="x"><span class="techinside">channel</span></a>s that communicate
values as specified by the <span class="RktVar">val</span> argument.</div></p><p>If the <span class="RktVar">val</span> argument is a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a>, then the resulting contract
is a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a>. Otherwise, the resulting contract is an impersonator
contract. When a channel contract is applied to a channel, the resulting channel
is not <span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._eq~3f%29%29" class="RktValLink" data-pltdoc="x">eq?</a></span> to the input.</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="RktSym">chan</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._channel%2Fc%29%29" class="RktValLink" data-pltdoc="x">channel/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></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="channel.html#%28def._%28%28quote._~23~25kernel%29._make-channel%29%29" class="RktValLink" data-pltdoc="x">make-channel</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="threads.html#%28def._%28%28quote._~23~25kernel%29._thread%29%29" class="RktValLink" data-pltdoc="x">thread</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~ce~bb%29%29" class="RktStxLink" data-pltdoc="x">λ</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="channel.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._channel-get%29%29" class="RktValLink" data-pltdoc="x">channel-get</a></span><span class="hspace"> </span><span class="RktSym">chan</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#<thread></span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="channel.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._channel-put%29%29" class="RktValLink" data-pltdoc="x">channel-put</a></span><span class="hspace"> </span><span class="RktSym">chan</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">not-a-string</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">chan: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">expected: string?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">given: 'not-a-string</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: (channel/c string?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (definition chan)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:2.0</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/misc..rkt)._prompt-tag/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%2Fmisc..rkt%29._prompt-tag%2Fc%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">prompt-tag/c</a></span></span><span class="hspace"> </span><span class="RktVar">contract</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="hspace"> </span><span class="RktVar">maybe-call/cc</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-call/cc</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">#:call/cc</span><span class="hspace"> </span><span class="RktVar">contract</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">#:call/cc</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="values.html#%28def._%28%28quote._~23~25kernel%29._values%29%29" class="RktValLink" data-pltdoc="x">values</a></span><span class="hspace"> </span><span class="RktVar">contract</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt"> </span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">contract</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Takes any number of contracts and returns a contract that recognizes
continuation prompt tags and will check any aborts or prompt handlers that
use the contracted prompt tag.</div></p><p>Each <span class="RktVar">contract</span> will check the corresponding value passed to
an <span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._abort-current-continuation%29%29" class="RktValLink" data-pltdoc="x">abort-current-continuation</a></span> and handled by the handler of a
call to <span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._call-with-continuation-prompt%29%29" class="RktValLink" data-pltdoc="x">call-with-continuation-prompt</a></span>.</p><p>If all of the <span class="RktVar">contract</span>s are <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contracts</span></a>, the resulting
contract will also be a <a href="chaperones.html#%28tech._chaperone%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone</span></a> contract. Otherwise, the contract is
an <a href="chaperones.html#%28tech._impersonator%29" class="techoutside" data-pltdoc="x"><span class="techinside">impersonator</span></a> contract.</p><p>If <span class="RktVar">maybe-call/cc</span> is provided, then the provided contracts
are used to check the return values from a continuation captured with
<span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._call-with-current-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-current-continuation</a></span>.</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="RktSym"><a href="creatingunits.html#%28form._%28%28lib._racket%2Funit..rkt%29._tag%29%29" class="RktStxLink" data-pltdoc="x">tag</a></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%2Fmisc..rkt%29._prompt-tag%2Fc%29%29" class="RktStxLink" data-pltdoc="x">prompt-tag/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="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span><span class="RktPn">)</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="cont.html#%28def._%28%28quote._~23~25kernel%29._make-continuation-prompt-tag%29%29" class="RktValLink" data-pltdoc="x">make-continuation-prompt-tag</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._call-with-continuation-prompt%29%29" class="RktValLink" data-pltdoc="x">call-with-continuation-prompt</a></span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._number-~3estring%29%29" class="RktValLink" data-pltdoc="x">number->string</a></span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._call-with-composable-continuation%29%29" class="RktValLink" data-pltdoc="x">call-with-composable-continuation</a></span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="cont.html#%28def._%28%28quote._~23~25kernel%29._abort-current-continuation%29%29" class="RktValLink" data-pltdoc="x">abort-current-continuation</a></span><span class="hspace"> </span><span class="RktSym"><a href="creatingunits.html#%28form._%28%28lib._racket%2Funit..rkt%29._tag%29%29" class="RktStxLink" data-pltdoc="x">tag</a></span><span class="hspace"> </span><span class="RktSym">k</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><span class="hspace"> </span><span class="RktSym"><a href="creatingunits.html#%28form._%28%28lib._racket%2Funit..rkt%29._tag%29%29" class="RktStxLink" data-pltdoc="x">tag</a></span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">k</span><span class="hspace"> </span><span class="RktVal">"not a number"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">tag: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">expected: number?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">given: "not a number"</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: the 1st argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(prompt-tag/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(-> number? string?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">#:call/cc)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (definition tag)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:2.0</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/misc..rkt)._continuation-mark-key/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._continuation-mark-key%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">continuation-mark-key/c</a></span></span><span class="hspace"> </span><span class="RktVar">contract</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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="contract-utilities.html#%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">Takes a single contract and returns a contract that recognizes
continuation marks and will check any mappings of marks to values
or any accesses of the mark value.</div></p><p>If the argument <span class="RktVar">contract</span> is a <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contract</span></a>, the resulting
contract will also be a <a href="chaperones.html#%28tech._chaperone%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone</span></a> contract. Otherwise, the contract is
an <a href="chaperones.html#%28tech._impersonator%29" class="techoutside" data-pltdoc="x"><span class="techinside">impersonator</span></a> contract.</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="RktSym">mark-key</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._continuation-mark-key%2Fc%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-key/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="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._make-continuation-mark-key%29%29" class="RktValLink" data-pltdoc="x">make-continuation-mark-key</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="wcm.html#%28form._%28%28quote._~23~25kernel%29._with-continuation-mark%29%29" class="RktStxLink" data-pltdoc="x">with-continuation-mark</a></span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktSym">mark-key</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">s</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._append%29%29" class="RktValLink" data-pltdoc="x">append</a></span><span class="hspace"> </span><span class="RktSym">s</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">truffle</span><span class="hspace"> </span><span class="RktVal">fudge</span><span class="hspace"> </span><span class="RktVal">ganache</span><span class="RktVal">)</span><span class="RktPn">)</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="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">mark-value</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._continuation-mark-set-first%29%29" class="RktValLink" data-pltdoc="x">continuation-mark-set-first</a></span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="contmarks.html#%28def._%28%28quote._~23~25kernel%29._current-continuation-marks%29%29" class="RktValLink" data-pltdoc="x">current-continuation-marks</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">mark-key</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">mark-value</span><span class="hspace"> </span><span class="RktVal">"chocolate-bar"</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p><span class="RktErr">mark-key: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">expected: symbol?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">given: "chocolate-bar"</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: the 1st argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(continuation-mark-key/c</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(-> symbol? (listof symbol?)))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (definition mark-key)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:2.0</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>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/private/misc..rkt)._evt/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._evt%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">evt/c</a></span></span><span class="hspace"> </span><span class="RktVar">contract</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._chaperone-contract~3f%29%29" class="RktValLink" data-pltdoc="x">chaperone-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="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._chaperone-contract~3f%29%29" class="RktValLink" data-pltdoc="x">chaperone-contract?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a contract that recognizes <a href="sync.html#%28tech._synchronizable._event%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronizable event</span></a>s whose
<a href="sync.html#%28tech._synchronization._result%29" class="techoutside" data-pltdoc="x"><span class="techinside">synchronization result</span></a>s are checked by the given
<span class="RktVar">contract</span>s.</div></p><p>The resulting contract is always a <a href="chaperones.html#%28tech._chaperone%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone</span></a> contract and its
arguments must all be <a href="contracts.html#%28tech._chaperone._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">chaperone contracts</span></a>.</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">my-evt</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._evt%2Fc%29%29" class="RktValLink" data-pltdoc="x">evt/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._evt~3f%29%29" class="RktValLink" data-pltdoc="x">evt?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._always-evt%29%29" class="RktValLink" data-pltdoc="x">always-evt</a></span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="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="RktSym">failing-evt</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._evt%2Fc%29%29" class="RktValLink" data-pltdoc="x">evt/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></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="sync.html#%28def._%28%28quote._~23~25kernel%29._alarm-evt%29%29" class="RktValLink" data-pltdoc="x">alarm-evt</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="time.html#%28def._%28%28quote._~23~25kernel%29._current-inexact-milliseconds%29%29" class="RktValLink" data-pltdoc="x">current-inexact-milliseconds</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">50</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._sync%29%29" class="RktValLink" data-pltdoc="x">sync</a></span><span class="hspace"> </span><span class="RktSym">my-evt</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#<always-evt></span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="sync.html#%28def._%28%28quote._~23~25kernel%29._sync%29%29" class="RktValLink" data-pltdoc="x">sync</a></span><span class="hspace"> </span><span class="RktSym">failing-evt</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">failing-evt: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">promised: event that produces 2 values</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">produced: event that produces 1 values</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: (evt/c number? number?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (definition failing-evt)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: (definition failing-evt)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:3.0</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/base..rkt)._flat-rec-contract))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._flat-rec-contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">flat-rec-contract</a></span></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">flat-contract-expr</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Constructs a recursive <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>. A
<span class="RktVar">flat-contract-expr</span> can refer to <span class="RktVar">id</span> to refer
recursively to the generated contract.</div></p><p>For example, the contract</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._flat-rec-contract%29%29" class="RktStxLink" data-pltdoc="x">flat-rec-contract</a></span><span class="hspace"> </span><span class="RktSym">sexp</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._cons%2Fc%29%29" class="RktValLink" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktSym">sexp</span><span class="hspace"> </span><span class="RktSym">sexp</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._number~3f%29%29" class="RktValLink" data-pltdoc="x">number?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._symbol~3f%29%29" class="RktValLink" data-pltdoc="x">symbol?</a></span><span class="RktPn">)</span></td></tr></table></blockquote><p>is a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> that checks for (a limited form of)
S-expressions. It says that a <span class="RktSym">sexp</span> is either two
<span class="RktSym">sexp</span>s combined 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>, or a number, or a symbol.</p><p>Note that if the contract is applied to a circular value, contract
checking will not terminate.</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/misc..rkt)._flat-murec-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%2Fmisc..rkt%29._flat-murec-contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">flat-murec-contract</a></span></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">flat-contract-expr</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">body</span><span class="hspace"> </span><span class="RktMeta">...+</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A generalization of <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._flat-rec-contract%29%29" class="RktStxLink" data-pltdoc="x">flat-rec-contract</a></span> for defining several
mutually recursive <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a> simultaneously. Each <span class="RktVar">id</span> is
visible in the entire <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._flat-murec-contract%29%29" class="RktStxLink" data-pltdoc="x">flat-murec-contract</a></span> form, and the
result of the final <span class="RktVar">body</span> is the result of the entire form.</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"><a name="(form._((lib._racket/contract/private/misc..rkt)._any))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">any</a></span></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Represents a contract that is always satisfied. In particular, it can accept
multiple values. It can only be used in a result position of contracts like
<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>. Using <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span> elsewhere is a syntax error.</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)._promise/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._promise%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">promise/c</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="contract-utilities.html#%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">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">Constructs a contract on a promise. The contract does not force the
promise, but when the promise is forced, the contract checks that the
result value meets the contract <span class="RktVar">c</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)._flat-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._flat-contract%29%29" class="RktValDef RktValLink" data-pltdoc="x">flat-contract</a></span></span><span class="hspace"> </span><span class="RktVar">predicate</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-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="#%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="#%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></table></blockquote></div><div class="SIntrapara">Constructs a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a> from <span class="RktVar">predicate</span>. A value
satisfies the contract if the predicate returns a true value.</div></p><p>This function is a holdover from before predicates could be used
directly as <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a>. It exists today for backwards compatibility.</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)._flat-contract-predicate))"></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._flat-contract-predicate%29%29" class="RktValDef RktValLink" data-pltdoc="x">flat-contract-predicate</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="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="#%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="#%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></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="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._flat-contract~3f%29%29" class="RktValLink" data-pltdoc="x">flat-contract?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Extracts the predicate from a <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contract</span></a>.</div></p><p>This function is a holdover from before <a href="contracts.html#%28tech._flat._contract%29" class="techoutside" data-pltdoc="x"><span class="techinside">flat contracts</span></a> could be used
directly as predicates. It exists today for backwards compatibility.</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)._suggest/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._suggest%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">suggest/c</a></span></span><span class="hspace"> </span><span class="RktVar">c</span><span class="hspace"> </span><span class="RktVar">field</span><span class="hspace"> </span><span class="RktVar">message</span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">c</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="contract-utilities.html#%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">field</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">message</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="strings.html#%28def._%28%28quote._~23~25kernel%29._string~3f%29%29" class="RktValLink" data-pltdoc="x">string?</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Returns a contract that behaves like <span class="RktVar">c</span>, except
that it adds an extra line to the error message on a contract
violation.</div></p><p>The <span class="RktVar">field</span> and <span class="RktVar">message</span> strings are added
following the guidelines in
<a href="exns.html#%28part._err-msg-conventions%29" data-pltdoc="x">Error Message Conventions</a>.</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">allow-calls?</span><span class="hspace"> </span><span class="RktVal">#f</span><span class="RktPn">)</span></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="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._suggest%2Fc%29%29" class="RktValLink" data-pltdoc="x">suggest/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%2A%29%29" class="RktStxLink" data-pltdoc="x"><span class="nobreak">-></span>*</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">#:pre</span><span class="hspace"> </span><span class="RktSym">allow-calls?</span><span class="hspace"> </span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%29%29" class="RktStxLink" data-pltdoc="x">any</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">"suggestion"</span><span class="hspace"> </span><span class="RktVal">"maybe you should set! allow-calls? to #t"</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktVal">5</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">f</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">f: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">#:pre condition</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">suggestion: maybe you should set! allow-calls? to #t</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">in: (->* () #:pre ... any)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">contract from: (function f)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">at: eval:3.0</span></p></td></tr></table></blockquote></div></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="contracts.html" title="backward to "8 Contracts"" data-pltdoc="x">← prev</a> <a href="contracts.html" title="up to "8 Contracts"" data-pltdoc="x">up</a> <a href="function-contracts.html" title="forward to "8.2 Function Contracts"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|