This file is indexed.

/usr/share/doc/racket/reference/attaching-contracts-to-values.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
<!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.6&nbsp;Attaching Contracts to Values</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,&quot;tocview_0&quot;);">&#9658;</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&nbsp;</td><td><a href="model.html" class="tocviewlink" data-pltdoc="x">Language Model</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="notation.html" class="tocviewlink" data-pltdoc="x">Notation for Documentation</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="syntax.html" class="tocviewlink" data-pltdoc="x">Syntactic Forms</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="data.html" class="tocviewlink" data-pltdoc="x">Datatypes</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="mzlib_class.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="mzlib_unit.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="contracts.html" class="tocviewselflink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Control Flow</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr><tr><td align="right">12&nbsp;</td><td><a href="Macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">13&nbsp;</td><td><a href="input-and-output.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">14&nbsp;</td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Reflection and Security</a></td></tr><tr><td align="right">15&nbsp;</td><td><a href="os.html" class="tocviewlink" data-pltdoc="x">Operating System</a></td></tr><tr><td align="right">16&nbsp;</td><td><a href="memory.html" class="tocviewlink" data-pltdoc="x">Memory Management</a></td></tr><tr><td align="right">17&nbsp;</td><td><a href="unsafe.html" class="tocviewlink" data-pltdoc="x">Unsafe Operations</a></td></tr><tr><td align="right">18&nbsp;</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,&quot;tocview_1&quot;);">&#9660;</a></td><td>8&nbsp;</td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr></table><div class="tocviewsublist" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">8.1&nbsp;</td><td><a href="data-structure-contracts.html" class="tocviewlink" data-pltdoc="x">Data-<wbr></wbr>structure Contracts</a></td></tr><tr><td align="right">8.2&nbsp;</td><td><a href="function-contracts.html" class="tocviewlink" data-pltdoc="x">Function Contracts</a></td></tr><tr><td align="right">8.3&nbsp;</td><td><a href="parametric-contracts.html" class="tocviewlink" data-pltdoc="x">Parametric Contracts</a></td></tr><tr><td align="right">8.4&nbsp;</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&nbsp;</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&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Attaching Contracts to Values</a></td></tr><tr><td align="right">8.7&nbsp;</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&nbsp;</td><td><a href="contract-utilities.html" class="tocviewlink" data-pltdoc="x">Contract Utilities</a></td></tr><tr><td align="right">8.9&nbsp;</td><td><a href="racket_contract_base.html" class="tocviewlink" data-pltdoc="x"><span class="RktModLink"><span class="RktSym">racket/<span class="mywbr"> &nbsp;</span>contract/<span class="mywbr"> &nbsp;</span>base</span></span></a></td></tr><tr><td align="right">8.10&nbsp;</td><td><a href="Legacy_Contracts.html" class="tocviewlink" data-pltdoc="x">Legacy Contracts</a></td></tr><tr><td align="right">8.11&nbsp;</td><td><a href="Random_generation.html" class="tocviewlink" data-pltdoc="x">Random generation</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_2&quot;);">&#9658;</a></td><td>8.6&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Attaching Contracts to Values</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">8.6.1&nbsp;</td><td><a href="#%28part._.Nested_.Contract_.Boundaries%29" class="tocviewlink" data-pltdoc="x">Nested Contract Boundaries</a></td></tr><tr><td align="right">8.6.2&nbsp;</td><td><a href="#%28part._.Low-level_.Contract_.Boundaries%29" class="tocviewlink" data-pltdoc="x">Low-<wbr></wbr>level Contract Boundaries</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="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">contract-<wbr></wbr>out</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._recontract-out%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">recontract-<wbr></wbr>out</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fprovide..rkt%29._provide%2Fcontract%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">provide/<span class="mywbr"> &nbsp;</span>contract</span></span></a></td></tr><tr><td><span class="tocsublinknumber">8.6.1<tt>&nbsp;</tt></span><a href="#%28part._.Nested_.Contract_.Boundaries%29" class="tocsubseclink" data-pltdoc="x">Nested Contract Boundaries</a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._with-contract%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">with-<wbr></wbr>contract</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define/<span class="mywbr"> &nbsp;</span>contract</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define-struct%2Fcontract%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define-<wbr></wbr>struct/<span class="mywbr"> &nbsp;</span>contract</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._invariant-assertion%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">invariant-<wbr></wbr>assertion</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._current-contract-region%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">current-<wbr></wbr>contract-<wbr></wbr>region</span></span></a></td></tr><tr><td><span class="tocsublinknumber">8.6.2<tt>&nbsp;</tt></span><a href="#%28part._.Low-level_.Contract_.Boundaries%29" class="tocsubseclink" data-pltdoc="x">Low-<wbr></wbr>level Contract Boundaries</a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fprovide..rkt%29._define-module-boundary-contract%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">define-<wbr></wbr>module-<wbr></wbr>boundary-<wbr></wbr>contract</span></span></a></td></tr><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">contract</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, &quot;6.7&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="Structure_Type_Property_Contracts.html" title="backward to &quot;8.5 Structure Type Property Contracts&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="contracts.html" title="up to &quot;8 Contracts&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="Building_New_Contract_Combinators.html" title="forward to &quot;8.7 Building New Contract Combinators&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h4 x-source-module="(lib &quot;scribblings/reference/reference.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;attaching-contracts-to-values&quot;">8.6<tt>&nbsp;</tt><a name="(part._attaching-contracts-to-values)"></a>Attaching Contracts to Values</h4><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/contract/base..rkt)._contract-out))"></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._contract-out%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">contract-out</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">p/c-item</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="stt">&nbsp;</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="specgrammar"><tr><td align="right" valign="baseline"><span class="RktVar">p/c-item</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><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">&nbsp;</span><span class="RktVar">id/super</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">struct-option</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="creatingunits.html#%28form._%28%28lib._racket%2Funit..rkt%29._rename%29%29" class="RktStxLink" data-pltdoc="x">rename</a></span><span class="hspace">&nbsp;</span><span class="RktVar">orig-id</span><span class="hspace">&nbsp;</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:&#8707;</span><span class="hspace">&nbsp;</span><span class="RktVar">poly-variables</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:exists</span><span class="hspace">&nbsp;</span><span class="RktVar">poly-variables</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:&#8704;</span><span class="hspace">&nbsp;</span><span class="RktVar">poly-variables</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:forall</span><span class="hspace">&nbsp;</span><span class="RktVar">poly-variables</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">poly-variables</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktVar">id</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">id/super</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktVar">id</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktVar">super-id</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">struct-option</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</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">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:omit-constructor</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">A <span class="RktVar">provide-spec</span> for use in <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span> (currently only for
the same <a href="syntax-model.html#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> as the <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span> form; for example,
<span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="RktStxLink" data-pltdoc="x">contract-out</a></span> cannot be nested within <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-syntax%29%29" class="RktStxLink" data-pltdoc="x">for-syntax</a></span>). Each <span class="RktVar">id</span>
is provided from the module. In
addition, clients of the module must live up to the contract specified
by <span class="RktVar">contract-expr</span> for each export.</div></p><p>The <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="RktStxLink" data-pltdoc="x">contract-out</a></span> form treats modules as units of
blame. The module that defines the provided variable is expected to
meet the positive (co-variant) positions of the contract. Each module
that imports the provided variable must obey the negative
(contra-variant) positions of the contract. Each <span class="RktVar">contract-expr</span>
in a <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="RktStxLink" data-pltdoc="x">contract-out</a></span> form is effectively moved to the end of the
enclosing module, so a <span class="RktVar">contract-expr</span> can refer to variables
that are defined later in the same module.</p><p>Only uses of the contracted variable outside the module are
checked. Inside the module, no contract checking occurs.</p><p>The <span class="RktSym"><a href="creatingunits.html#%28form._%28%28lib._racket%2Funit..rkt%29._rename%29%29" class="RktStxLink" data-pltdoc="x">rename</a></span> form of <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="RktStxLink" data-pltdoc="x">contract-out</a></span> exports the
first variable (the internal name) with the name specified by the
second variable (the external name).</p><p>The <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> form of <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="RktStxLink" data-pltdoc="x">contract-out</a></span>
provides a structure-type definition, and each field has a contract
that dictates the contents of the fields. The structure-type
definition must appear before the <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span> clause within the
enclosing module. If the structure type has a parent, the second
<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> form (above) must be used, with the first name
referring to the structure type to export and the second name
referring to the parent structure type. Unlike a <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>
definition, however, all of the fields (and their contracts) must be
listed. The contract on the fields that the sub-struct shares with its
parent are only used in the contract for the sub-struct&rsquo;s constructor, and
the selector or mutators for the super-struct are not provided. The
exported structure-type name always doubles as a constructor, even if
the original structure-type name does not act as a constructor.
If the <span class="RktPn">#:omit-constructor</span> option is present, the constructor
is not provided.</p><p>The <span class="RktPn">#:&#8707;</span>, <span class="RktPn">#:exists</span>, <span class="RktPn">#:&#8704;</span>, and <span class="RktPn">#:forall</span>
clauses define new abstract contracts. The variables are bound in the
remainder of the <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="RktStxLink" data-pltdoc="x">contract-out</a></span> form to new contracts that hide
the values they accept and ensure that the exported functions are treated
parametrically. See <span class="RktSym"><a href="parametric-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._new-~e2~88~83%2Fc%29%29" class="RktValLink" data-pltdoc="x">new-&#8707;/c</a></span> and <span class="RktSym"><a href="parametric-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._new-~e2~88~80%2Fc%29%29" class="RktValLink" data-pltdoc="x">new-&#8704;/c</a></span> for details
on how the clauses hide the values.</p><p>The implementation of <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="RktStxLink" data-pltdoc="x">contract-out</a></span> uses
<span class="RktSym"><a href="stxprops.html#%28def._%28%28quote._~23~25kernel%29._syntax-property%29%29" class="RktValLink" data-pltdoc="x">syntax-property</a></span> to attach properties to the code it generates
that records the syntax of the contracts in the fully expanded program.
Specifically, the symbol <a name="(idx._(gentag._171._(lib._scribblings/reference/reference..scrbl)))"></a><span class="RktVal">'</span><span class="RktVal">provide/contract-original-contract</span>
is bound to vectors of two elements, the exported identifier and a
syntax object for the expression that produces the contract controlling
the export.</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)._recontract-out))"></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._recontract-out%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">recontract-out</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A <span class="RktVar">provide-spec</span> for use in <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span> (currently,
  just like <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="RktStxLink" data-pltdoc="x">contract-out</a></span>, only for
  the same <a href="syntax-model.html#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> as the <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span> form).</div></p><p>It re-exports <span class="RktVar">id</span>, but with positive blame associated
to the module containing <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._recontract-out%29%29" class="RktStxLink" data-pltdoc="x">recontract-out</a></span> instead of the
location of the original site of <span class="RktVar">id</span>.</p><p>This can be useful when a public module wants to export an
identifier from a private module but where any contract violations
should be reported in terms of the public module instead of the
private one.</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">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span><span class="hspace">&nbsp;</span><span class="RktSym">private-implementation</span><span class="hspace">&nbsp;</span><span class="RktSym">racket/base</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktSym">racket/contract</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</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">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">recip</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2F%29%29" class="RktValLink" data-pltdoc="x">/</a></span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</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">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">non-zero?</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="booleans.html#%28def._%28%28quote._~23~25kernel%29._not%29%29" class="RktValLink" data-pltdoc="x">not</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._~3d%29%29" class="RktValLink" data-pltdoc="x">=</a></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fprovide..rkt%29._provide%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">provide/contract</a></span><span class="hspace">&nbsp;</span><span class="RktPn">[</span><span class="RktSym">recip</span><span class="hspace">&nbsp;</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">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._and%2Fc%29%29" class="RktValLink" data-pltdoc="x">and/c</a></span><span class="hspace">&nbsp;</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">&nbsp;</span><span class="RktSym">non-zero?</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%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">&nbsp;</span><span class="RktVal"><span class="nobreak">-1</span></span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</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">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="createclass.html#%28form._%28%28lib._racket%2Fprivate%2Fclass-internal..rkt%29._public%29%29" class="RktStxLink" data-pltdoc="x">public</a></span><span class="hspace">&nbsp;</span><span class="RktSym">racket/base</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktSym">racket/contract</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">'</span><span class="RktVal">private-implementation</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._recontract-out%29%29" class="RktStxLink" data-pltdoc="x">recontract-out</a></span><span class="hspace">&nbsp;</span><span class="RktSym">recip</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">public</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">recip</span><span class="hspace">&nbsp;</span><span class="RktVal">+nan.0</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">recip: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">promised: (between/c -1 1)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">produced: +nan.0</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the range of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(and/c real? non-zero?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(between/c -1 1))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: public</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: public</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">at: eval:3.0</span></p></td></tr></table></blockquote></div></p><p>Replacing the use of <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._recontract-out%29%29" class="RktStxLink" data-pltdoc="x">recontract-out</a></span> with just
<span class="RktSym">recip</span> would result in a contract violation blaming
the private module.</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/provide..rkt)._provide/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%2Fprovide..rkt%29._provide%2Fcontract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">provide/contract</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">p/c-item</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">A legacy shorthand for <span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="RktStxLink" data-pltdoc="x">contract-out</a></span><span class="stt"> </span><span class="RktVar">p/c-item</span><span class="stt"> </span><span class="RktMeta"><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><span class="RktPn">)</span>,
except that a <span class="RktVar">contract-expr</span> within <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fprovide..rkt%29._provide%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">provide/contract</a></span>
is evaluated at the position of the <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fprovide..rkt%29._provide%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">provide/contract</a></span> form
instead of at the end of the enclosing module.</div></p><h5 x-source-module="(lib &quot;scribblings/reference/reference.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;Nested_Contract_Boundaries&quot;">8.6.1<tt>&nbsp;</tt><a name="(part._.Nested_.Contract_.Boundaries)"></a><a name="(mod-path._racket/contract/region)"></a>Nested Contract Boundaries</h5><p><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._racket%2Fcontract%2Fregion%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">racket/contract/region</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller">&nbsp;package:</span> <span class="stt">base</span></span></td></tr></table></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(form._((lib._racket/contract/region..rkt)._with-contract))"></a><span title="Provided from: racket/contract/region, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._with-contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">with-contract</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">blame-id</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">wc-export</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVar">free-var-list</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="hspace">&nbsp;</span><span class="RktVar">body</span><span class="hspace">&nbsp;</span><span class="RktMeta">...+</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%2Fregion..rkt%29._with-contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">with-contract</a></span><span class="hspace">&nbsp;</span><span class="RktVar">blame-id</span><span class="hspace">&nbsp;</span><span class="RktVar">results-spec</span><span class="hspace">&nbsp;</span><span class="RktVar">free-var-list</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="hspace">&nbsp;</span><span class="RktVar">body</span><span class="hspace">&nbsp;</span><span class="RktMeta">...+</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&nbsp;</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="specgrammar"><tr><td align="right" valign="baseline"><span class="RktVar">wc-export</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">result-spec</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:result</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:results</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">contract-expr</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">free-var-list</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</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">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:freevar</span><span class="hspace">&nbsp;</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:freevars</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="RktPn">]</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Generates a local contract boundary.</div></p><p>The first <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._with-contract%29%29" class="RktStxLink" data-pltdoc="x">with-contract</a></span> form cannot appear in expression position.
All names defined within the first <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._with-contract%29%29" class="RktStxLink" data-pltdoc="x">with-contract</a></span> form are
visible externally, but those names listed in the <span class="RktVar">wc-export</span>
list are protected with the corresponding contract.  The <span class="RktVar">body</span> of
the form allows definition/expression interleaving if its context does.</p><p>The second <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._with-contract%29%29" class="RktStxLink" data-pltdoc="x">with-contract</a></span> form must appear in expression position.
The final <span class="RktVar">body</span> expression should return the same number of values
as the number of contracts listed in the <span class="RktVar">result-spec</span>, and each
returned value is contracted with its respective contract.  The sequence
of <span class="RktVar">body</span> forms is treated as for <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>.</p><p>The <span class="RktVar">blame-id</span> is used for the positive positions of
contracts paired with exported <span class="RktVar">id</span>s.  Contracts broken
within the <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._with-contract%29%29" class="RktStxLink" data-pltdoc="x">with-contract</a></span> <span class="RktVar">body</span> will use the
<span class="RktVar">blame-id</span> for their negative position.</p><p>If a free-var-list is given, then any uses of the free variables
inside the <span class="RktVar">body</span> will be protected with contracts that
blame the context of the <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._with-contract%29%29" class="RktStxLink" data-pltdoc="x">with-contract</a></span> form for the positive
positions and the <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._with-contract%29%29" class="RktStxLink" data-pltdoc="x">with-contract</a></span> form for the negative ones.</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/region..rkt)._define/contract))"></a><span title="Provided from: racket/contract/region, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define/contract</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">id</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="hspace">&nbsp;</span><span class="RktVar">free-var-list</span><span class="hspace">&nbsp;</span><span class="RktVar">init-value-expr</span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define/contract</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">head</span><span class="hspace">&nbsp;</span><span class="RktVar">args</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="hspace">&nbsp;</span><span class="RktVar">free-var-list</span><span class="hspace">&nbsp;</span><span class="RktVar">body</span><span class="hspace">&nbsp;</span><span class="RktMeta">...+</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">Works like <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>, except that the contract
<span class="RktVar">contract-expr</span> is attached to the bound value.  For the
definition of <span class="RktVar">head</span> and <span class="RktVar">args</span>, see <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>.
For the definition of <span class="RktVar">free-var-list</span>, see <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._with-contract%29%29" class="RktStxLink" data-pltdoc="x">with-contract</a></span>.</div></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">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span><span class="hspace">&nbsp;</span><span class="RktSym">distance</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._~3e~3d%2Fc%29%29" class="RktValLink" data-pltdoc="x">&gt;=/c</a></span><span class="hspace">&nbsp;</span><span class="RktVal">0</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">43.52</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">furlongs-&gt;feet</span><span class="hspace">&nbsp;</span><span class="RktSym">fr</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</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">-&gt;</span></a></span><span class="hspace">&nbsp;</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">&nbsp;</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">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2A%29%29" class="RktValLink" data-pltdoc="x">*</a></span><span class="hspace">&nbsp;</span><span class="RktVal">660</span><span class="hspace">&nbsp;</span><span class="RktSym">fr</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">a contract violation expected here:</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">furlongs-&gt;feet</span><span class="hspace">&nbsp;</span><span class="RktVal">"not a furlong"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">furlongs-&gt;feet: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">expected: real?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">given: "not a furlong"</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the 1st argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt; real? real?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: (function furlongs-&gt;feet)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">at: eval:3.0</span></p></td></tr></table></blockquote></div></p><p>The <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span> form treats the individual definition as
a contract region. The definition itself is responsible for positive
(co-variant) positions of the contract, and references to
<span class="RktVar">id</span> outside of the definition must meet the negative
positions of the contract. Since the contract boundary is
between the definition and the surrounding context, references to
<span class="RktVar">id</span> inside the <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span> form are not checked.</p><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">an unsual predicate that prints when called</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">printing-int?</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="Writing.html#%28def._%28%28lib._racket%2Fprivate%2Fmisc..rkt%29._displayln%29%29" class="RktValLink" data-pltdoc="x">displayln</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"I was called"</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</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><span class="hspace">&nbsp;</span><span class="RktSym">x</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">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fact</span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</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">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktSym">printing-int?</span><span class="hspace">&nbsp;</span><span class="RktSym">printing-int?</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="if.html#%28form._%28%28quote._~23~25kernel%29._if%29%29" class="RktStxLink" data-pltdoc="x">if</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._zero~3f%29%29" class="RktValLink" data-pltdoc="x">zero?</a></span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVal">1</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2A%29%29" class="RktValLink" data-pltdoc="x">*</a></span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">fact</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._sub1%29%29" class="RktValLink" data-pltdoc="x">sub1</a></span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="RktPn">)</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">&gt; </span><span class="RktPn">(</span><span class="RktSym">fact</span><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">only prints twice, not for each recursive call</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td><p><span class="RktOut">I was called</span></p></td></tr><tr><td><p><span class="RktOut">I was called</span></p></td></tr></table></td></tr><tr><td><p><span class="RktRes">120</span></p></td></tr></table></blockquote></div></p><p>If a free-var-list is given, then any uses of the free variables
inside the <span class="RktVar">body</span> will be protected with contracts that
blame the context of the <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span> form for the positive
positions and the <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span> form for the negative ones.</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">&gt; </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">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">integer-&gt;binary-string</span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</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-&gt;string</a></span><span class="hspace">&nbsp;</span><span class="RktSym">n</span><span class="hspace">&nbsp;</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">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">numbers-&gt;strings</span><span class="hspace">&nbsp;</span><span class="RktSym">lst</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</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">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</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><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</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">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">#:freevar</span><span class="hspace">&nbsp;</span><span class="RktSym">integer-&gt;binary-string</span><span class="hspace">&nbsp;</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">-&gt;</span></a></span><span class="hspace">&nbsp;</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><span class="hspace">&nbsp;</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">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktCmt">;</span><span class="RktCmt">&nbsp;</span><span class="RktCmt">mistake, lst might contain inexact numbers</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28lib._racket%2Fprivate%2Fmap..rkt%29._map%29%29" class="RktValLink" data-pltdoc="x">map</a></span><span class="hspace">&nbsp;</span><span class="RktSym">integer-&gt;binary-string</span><span class="hspace">&nbsp;</span><span class="RktSym">lst</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">numbers-&gt;strings</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">4.0</span><span class="hspace">&nbsp;</span><span class="RktVal">3.3</span><span class="hspace">&nbsp;</span><span class="RktVal">5.8</span><span class="RktVal">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">integer-&gt;binary-string: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">expected: exact-integer?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">given: 4.0</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the 1st argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt; exact-integer? string?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: (function numbers-&gt;strings)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</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><table cellspacing="0" cellpadding="0" class="RktBlk RForeground"><tr><td><span class="RktPn">(</span><a name="(form._((lib._racket/contract/region..rkt)._define-struct/contract))"></a><span title="Provided from: racket/contract/region, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define-struct%2Fcontract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-struct/contract</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">struct-id</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktVar">field</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="RktPn">]</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVar">struct-option</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define-struct%2Fcontract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-struct/contract</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">struct-id</span><span class="hspace">&nbsp;</span><span class="RktVar">super-struct-id</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktVar">field</span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="RktPn">]</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVar">struct-option</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Works like <span class="RktSym"><a href="define-struct.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-struct%29%29" class="RktStxLink" data-pltdoc="x">define-struct</a></span>, except that the arguments to the constructor,
accessors, and mutators are protected by contracts.  For the definitions of
<span class="RktVar">field</span> and <span class="RktVar">struct-option</span>, see <span class="RktSym"><a href="define-struct.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-struct%29%29" class="RktStxLink" data-pltdoc="x">define-struct</a></span>.</div></p><p>The <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define-struct%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define-struct/contract</a></span> form only allows a subset of the
<span class="RktVar">struct-option</span> keywords: <span class="RktPn">#:mutable</span>, <span class="RktPn">#:transparent</span>,
<span class="RktPn">#:auto-value</span>, <span class="RktPn">#:omit-define-syntaxes</span>, <span class="RktPn">#:property</span> and
<span class="RktPn">#:omit-define-values</span>.</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">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define-struct%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define-struct/contract</a></span><span class="hspace">&nbsp;</span><span class="RktSym">fish</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">color</span><span class="hspace">&nbsp;</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><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">make-fish</span><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#&lt;fish&gt;</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">make-fish</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">make-fish: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">expected: number?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">given: #f</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the 1st argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt; number? symbol? any)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: (struct fish)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define-struct%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define-struct/contract</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">salmon</span><span class="hspace">&nbsp;</span><span class="RktSym">fish</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">ocean</span><span class="hspace">&nbsp;</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="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">make-salmon</span><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">atlantic</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#&lt;salmon&gt;</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">make-salmon</span><span class="hspace">&nbsp;</span><span class="RktVal">5</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">make-salmon: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">expected: symbol?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">given: #f</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the 2nd argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt; any/c symbol? symbol? any)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: (struct salmon)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">make-salmon</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">pacific</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">make-fish: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">expected: number?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">given: #f</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the 1st argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt; number? symbol? any)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: (struct fish)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</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/base..rkt)._invariant-assertion))"></a><span title="Provided from: racket/contract/region, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._invariant-assertion%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">invariant-assertion</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">invariant-expr</span><span class="hspace">&nbsp;</span><span class="RktVar">expr</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Establishes an invariant of <span class="RktVar">expr</span>, determined by <span class="RktVar">invariant-expr</span>.</div></p><p>Unlike the specification of a contract, an
<span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._invariant-assertion%29%29" class="RktStxLink" data-pltdoc="x">invariant-assertion</a></span> does not establish a boundary
between two parties. Instead, it simply attaches a logical assertion
to the value. Because the form uses contract machinery to check the
assertion, the surrounding module is treated as the party to be blamed
for any violations of the assertion.</p><p>This means, for example, that the assertion is checked on
recursive calls, when an invariant is used on the right-hand
side of a definition:</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">&gt; </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">&nbsp;</span><span class="RktSym">furlongss-&gt;feets</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._invariant-assertion%29%29" class="RktStxLink" data-pltdoc="x">invariant-assertion</a></span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;</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">-&gt;</span></a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</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">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._listof%29%29" class="RktValLink" data-pltdoc="x">listof</a></span><span class="hspace">&nbsp;</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="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;</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">&#955;</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">l</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28lib._racket%2Flist..rkt%29._empty~3f%29%29" class="RktValLink" data-pltdoc="x">empty?</a></span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktSym"><a href="pairs.html#%28def._%28%28lib._racket%2Flist..rkt%29._empty%29%29" class="RktValLink" data-pltdoc="x">empty</a></span><span class="RktPn">]</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="if.html#%28form._%28%28quote._~23~25kernel%29._if%29%29" class="RktStxLink" data-pltdoc="x">if</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._~3d%29%29" class="RktValLink" data-pltdoc="x">=</a></span><span class="hspace">&nbsp;</span><span class="RktVal">327</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">furlongss-&gt;feets</span><span class="hspace">&nbsp;</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">&nbsp;</span><span class="RktVal">"wha?"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">furlongs-&gt;feet</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28lib._racket%2Flist..rkt%29._first%29%29" class="RktValLink" data-pltdoc="x">first</a></span><span class="hspace">&nbsp;</span><span class="RktSym">l</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym">furlongss-&gt;feets</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="pairs.html#%28def._%28%28lib._racket%2Flist..rkt%29._rest%29%29" class="RktValLink" data-pltdoc="x">rest</a></span><span class="hspace">&nbsp;</span><span class="RktSym">l</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><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">furlongss-&gt;feets</span><span class="hspace">&nbsp;</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">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">2</span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'(660 1320 1980)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">furlongss-&gt;feets</span><span class="hspace">&nbsp;</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">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktVal">327</span><span class="hspace">&nbsp;</span><span class="RktVal">3</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">furlongss-&gt;feets: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">expected: real?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">given: "wha?"</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: an element of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">the 1st argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt; (listof real?) (listof real?))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: top-level</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">at: eval:5.0</span></p></td></tr></table></blockquote></div></p><p class="SHistory">Added in version 6.0.1.11 of package <span class="stt">base</span>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>syntax</p></div></div><p class="RForeground"><a name="(form._((lib._racket/contract/private/base..rkt)._current-contract-region))"></a><span title="Provided from: racket/contract/region, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._current-contract-region%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">current-contract-region</a></span></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Bound by <span class="RktSym"><a href="stxparam.html#%28form._%28%28lib._racket%2Fstxparam..rkt%29._define-syntax-parameter%29%29" class="RktStxLink" data-pltdoc="x">define-syntax-parameter</a></span>, this contains
information about the current contract region, used by
the above forms to determine the candidates for blame
assignment.</div></p><h5 x-source-module="(lib &quot;scribblings/reference/reference.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;Low-level_Contract_Boundaries&quot;">8.6.2<tt>&nbsp;</tt><a name="(part._.Low-level_.Contract_.Boundaries)"></a>Low-level Contract Boundaries</h5><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/provide..rkt)._define-module-boundary-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%2Fprovide..rkt%29._define-module-boundary-contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">define-module-boundary-contract</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">id</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">orig-id</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">contract-expr</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">pos-blame-party</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">source-loc</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><span class="stt">&nbsp;</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="specgrammar"><tr><td align="right" valign="baseline"><span class="RktVar">pos-blame-party</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</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">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:pos-source</span><span class="hspace">&nbsp;</span><span class="RktVar">pos-source-expr</span></td></tr><tr><td align="right" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td></tr><tr><td align="right" valign="baseline"><span class="RktVar">source-loc</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt">&nbsp;</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">&nbsp;</span></td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt">&nbsp;</span></td><td align="left" valign="baseline"><span class="RktPn">#:srcloc</span><span class="hspace">&nbsp;</span><span class="RktVar">srcloc-expr</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">Defines <span class="RktVar">id</span> to be <span class="RktVar">orig-id</span>, but with the contract
<span class="RktVar">contract-expr</span>.</div></p><p>The identifier <span class="RktVar">id</span> is defined as a macro transformer that
consults the context of its use to determine the name for negative
blame assignment (using the entire module where a reference appears
as the negative party).</p><p>The positive party defaults to the module containing the use of
<span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fprovide..rkt%29._define-module-boundary-contract%29%29" class="RktStxLink" data-pltdoc="x">define-module-boundary-contract</a></span>, but can be specified explicitly
via the <span class="RktPn">#:pos-source</span> keyword.</p><p>The source location used in the blame error messages for the location
of the place where the contract was put on the value defaults to the
source location of the use of <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fprovide..rkt%29._define-module-boundary-contract%29%29" class="RktStxLink" data-pltdoc="x">define-module-boundary-contract</a></span>,
but can be specified via the <span class="RktPn">#:srcloc</span> argument, in which case
it can be any of the things that the third argument to <span class="RktSym"><a href="stxops.html#%28def._%28%28quote._~23~25kernel%29._datum-~3esyntax%29%29" class="RktValLink" data-pltdoc="x">datum-&gt;syntax</a></span>
can be.</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">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span><span class="hspace">&nbsp;</span><span class="RktSym">server</span><span class="hspace">&nbsp;</span><span class="RktSym">racket/base</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktSym">racket/contract/base</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</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">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">f</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fprovide..rkt%29._define-module-boundary-contract%29%29" class="RktStxLink" data-pltdoc="x">define-module-boundary-contract</a></span><span class="hspace">&nbsp;</span><span class="RktSym">g</span><span class="hspace">&nbsp;</span><span class="RktSym">f</span><span class="hspace">&nbsp;</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">-&gt;</span></a></span><span class="hspace">&nbsp;</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">&nbsp;</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="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span><span class="hspace">&nbsp;</span><span class="RktSym">g</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">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span><span class="hspace">&nbsp;</span><span class="RktSym">client</span><span class="hspace">&nbsp;</span><span class="RktSym">racket/base</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">server</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</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">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">clients-fault</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">g</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</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">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">servers-fault</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">g</span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span><span class="hspace">&nbsp;</span><span class="RktSym">servers-fault</span><span class="hspace">&nbsp;</span><span class="RktSym">clients-fault</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">client</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">clients-fault</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">g: contract violation</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">expected: integer?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">given: #f</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the 1st argument of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt; integer? integer?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: 'server</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: client</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">at: eval:2.0</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">servers-fault</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">g: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">promised: integer?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">produced: #f</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: the range of</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(-&gt; integer? integer?)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: 'server</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: (quote server)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</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><table cellspacing="0" cellpadding="0" class="RktBlk RForeground"><tr><td><span class="RktPn">(</span><a name="(form._((lib._racket/contract/private/base..rkt)._contract))"></a><span title="Provided from: racket/contract/base, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">contract</a></span></span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="hspace">&nbsp;</span><span class="RktVar">to-protect-expr</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVar">positive-blame-expr</span><span class="hspace">&nbsp;</span><span class="RktVar">negative-blame-expr</span><span class="RktPn">)</span></td></tr></table></blockquote></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">contract</a></span><span class="hspace">&nbsp;</span><span class="RktVar">contract-expr</span><span class="hspace">&nbsp;</span><span class="RktVar">to-protect-expr</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVar">positive-blame-expr</span><span class="hspace">&nbsp;</span><span class="RktVar">negative-blame-expr</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktVar">value-name-expr</span><span class="hspace">&nbsp;</span><span class="RktVar">source-location-expr</span><span class="RktPn">)</span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara">The primitive mechanism for attaching a contract to a value. The
purpose of <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract%29%29" class="RktStxLink" data-pltdoc="x">contract</a></span> is as a target for the expansion of some
higher-level contract specifying form.</div></p><p>The <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract%29%29" class="RktStxLink" data-pltdoc="x">contract</a></span> expression adds the contract specified by
<span class="RktVar">contract-expr</span> to the value produced by
<span class="RktVar">to-protect-expr</span>. The result of a <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract%29%29" class="RktStxLink" data-pltdoc="x">contract</a></span> expression
is the result of the <span class="RktVar">to-protect-expr</span> expression, but with the
contract specified by <span class="RktVar">contract-expr</span> enforced on
<span class="RktVar">to-protect-expr</span>.</p><p>The values of <span class="RktVar">positive-blame-expr</span> and <span class="RktVar">negative-blame-expr</span>
indicate how to assign blame for positive and negative positions of the contract
specified by <span class="RktVar">contract-expr</span>.  They may be any value, and are formatted
as by <span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span> for purposes of contract violation error messages.</p><p><div class="SIntrapara">If specified, <span class="RktVar">value-name-expr</span> indicates a name for the protected value
to be used in error messages.  If not supplied, or if <span class="RktVar">value-name-expr</span>
produces <span class="RktVal">#f</span>, no name is printed.  Otherwise, it is also formatted as by
<span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span>. More precisely, the <span class="RktVar">value-name-expr</span> ends up in the
<span class="RktSym">blame-name</span> field of the blame record, which is used as the first portion
of the error message.
</div><div class="SIntrapara"><p><div class="SIntrapara">Examples:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract%29%29" class="RktStxLink" data-pltdoc="x">contract</a></span><span class="hspace">&nbsp;</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">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">pos</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">neg</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">timothy</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">timothy: broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">promised: integer?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">produced: #f</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: integer?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: pos</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: pos</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fprivate%2Fbase..rkt%29._contract%29%29" class="RktStxLink" data-pltdoc="x">contract</a></span><span class="hspace">&nbsp;</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">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">pos</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">neg</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">broke its own contract</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">promised: integer?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">produced: #f</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">in: integer?</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: pos</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: pos</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;</span><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">(assuming the contract is correct)</span></p></td></tr></table></blockquote></div></p></div></p><p>If specified, <span class="RktVar">source-location-expr</span> indicates the source location
reported by contract violations.  The expression must produce a <span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._srcloc%29%29" class="RktValLink" data-pltdoc="x">srcloc</a></span>
structure, <a href="syntax-model.html#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a>, <span class="RktVal">#f</span>, or a list or vector in the format
accepted by the third argument to <span class="RktSym"><a href="stxops.html#%28def._%28%28quote._~23~25kernel%29._datum-~3esyntax%29%29" class="RktValLink" data-pltdoc="x">datum-&gt;syntax</a></span>.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &quot;6.7&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="Structure_Type_Property_Contracts.html" title="backward to &quot;8.5 Structure Type Property Contracts&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="contracts.html" title="up to &quot;8 Contracts&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="Building_New_Contract_Combinators.html" title="forward to &quot;8.7 Building New Contract Combinators&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>