This file is indexed.

/usr/share/doc/racket/reference/parametric-contracts.html is in racket-doc 6.7-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!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.3&nbsp;Parametric Contracts</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="extras.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&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="tocviewsublistbottom" 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="" class="tocviewselflink" 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="attaching-contracts-to-values.html" class="tocviewlink" 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><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="#%28form._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._parametric-~3e%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktStxLink">parametric-<wbr></wbr>&gt;/<span class="mywbr"> &nbsp;</span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._new-~e2~88~80%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">new-<wbr></wbr>∀/<span class="mywbr"> &nbsp;</span>c</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._new-~e2~88~83%2Fc%29%29" class="tocsublink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">new-<wbr></wbr>∃/<span class="mywbr"> &nbsp;</span>c</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, &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="function-contracts.html" title="backward to &quot;8.2 Function 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="Lazy_Data-structure_Contracts.html" title="forward to &quot;8.4 Lazy Data-structure Contracts&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;parametric-contracts&quot;">8.3<tt>&nbsp;</tt><a name="(part._parametric-contracts)"></a><a name="(mod-path._racket/contract/parametric)"></a>Parametric Contracts</h4><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="" class="RktModLink" data-pltdoc="x"><span class="RktSym">racket/contract/parametric</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>The most convenient way to use parametric contract is to use
<span class="RktSym"><a href="attaching-contracts-to-values.html#%28form._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._contract-out%29%29" class="RktStxLink" data-pltdoc="x">contract-out</a></span>&rsquo;s <span class="RktPn">#:exists</span> keyword.
The <a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">racket/contract/parametric</span></a> provides a few more,
general-purpose parametric contracts.</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/parametric..rkt)._parametric-~3e/c))"></a><span title="Provided from: racket/contract/parametric, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._parametric-~3e%2Fc%29%29" class="RktStxDef RktStxLink" data-pltdoc="x">parametric-&gt;/c</a></span></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktVar">x</span><span class="hspace">&nbsp;</span><span class="RktMeta">...</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span><span class="RktVar">c</span><span class="RktPn">)</span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">Creates a contract for parametric polymorphic functions.  Each function is
protected by <span class="RktVar">c</span>, where each <span class="RktVar">x</span> is bound in <span class="RktVar">c</span> and refers
to a polymorphic type that is instantiated each time the function is applied.</div></p><p>At each application of a function, the <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._parametric-~3e%2Fc%29%29" class="RktStxLink" data-pltdoc="x">parametric-&gt;/c</a></span> contract constructs
a new opaque wrapper for each <span class="RktVar">x</span>; values flowing into the polymorphic
function (i.e. values protected by some <span class="RktVar">x</span> in negative position with
respect to <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._parametric-~3e%2Fc%29%29" class="RktStxLink" data-pltdoc="x">parametric-&gt;/c</a></span>) are wrapped in the corresponding opaque
wrapper.  Values flowing out of the polymorphic function (i.e. values protected
by some <span class="RktVar">x</span> in positive position with respect to <span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._parametric-~3e%2Fc%29%29" class="RktStxLink" data-pltdoc="x">parametric-&gt;/c</a></span>)
are checked for the appropriate wrapper.  If they have it, they are unwrapped;
if they do not, a contract violation is signaled.</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="attaching-contracts-to-values.html#%28form._%28%28lib._racket%2Fcontract%2Fregion..rkt%29._define%2Fcontract%29%29" class="RktStxLink" data-pltdoc="x">define/contract</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">check</span><span class="hspace">&nbsp;</span><span class="RktVar">x</span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="#%28form._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._parametric-~3e%2Fc%29%29" class="RktStxLink" data-pltdoc="x">parametric-&gt;/c</a></span><span class="hspace">&nbsp;</span><span class="RktPn">[</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._boolean~3f%29%29" class="RktValLink" data-pltdoc="x">boolean?</a></span><span class="hspace">&nbsp;</span><span class="RktSym">X</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="RktPn"> .</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="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="if.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._or%29%29" class="RktStxLink" data-pltdoc="x">or</a></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="RktVar">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._equal~3f%29%29" class="RktValLink" data-pltdoc="x">equal?</a></span><span class="hspace">&nbsp;</span><span class="RktSym">y</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">surprise</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;</span><span class="RktVal">'</span><span class="RktVal">invalid</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym">y</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">check</span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">ok</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'ok</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">check</span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">ignored</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">check: 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: X</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">produced: 'invalid</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">(parametric-&gt;/c (X) (-&gt; boolean? X X))</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">contract from: (function check)</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktErr">blaming: (function check)</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">check</span><span class="hspace">&nbsp;</span><span class="RktVal">#t</span><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">surprise</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">'surprise</span></p></td></tr></table></blockquote></div></p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/parametric..rkt)._new-~e2~88~80/c))"></a><span title="Provided from: racket/contract/parametric, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._new-~e2~88~80%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">new-&#8704;/c</a></span></span><span class="hspace">&nbsp;</span>[<span class="RktVar">name</span>]<span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">name</span><span class="hspace">&nbsp;</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._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></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="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Constructs a new universal contract.</div></p><p>Universal contracts accept all values when in negative positions (e.g., function
inputs) and wrap them in an opaque struct, hiding the precise value.
In positive positions (e.g. function returns),
a universal contract accepts only values that were previously accepted
in negative positions (by checking for the wrappers).</p><p>The name is used to identify the contract in error messages and defaults
to a name based on the lexical context of <span class="RktSym"><a href="#%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>.</p><p><div class="SIntrapara">For example, this contract:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="#%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><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">a</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="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</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">describes the identity function (or a non-terminating function).
That is, the first use of the <span class="RktSym">a</span> appears in a
negative position and thus inputs to that function are wrapped with an opaque struct.
Then, when the function returns, it is checked to determine whether the result is wrapped, since
the second <span class="RktSym">a</span> appears in a positive position.</div></p><p>The <span class="RktSym"><a href="#%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> contract constructor is dual to <span class="RktSym"><a href="#%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>.</p><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._racket/contract/parametric..rkt)._new-~e2~88~83/c))"></a><span title="Provided from: racket/contract/parametric, racket/contract, racket | Package: base"><span class="RktSym"><a href="#%28def._%28%28lib._racket%2Fcontract%2Fparametric..rkt%29._new-~e2~88~83%2Fc%29%29" class="RktValDef RktValLink" data-pltdoc="x">new-&#8707;/c</a></span></span><span class="hspace">&nbsp;</span>[<span class="RktVar">name</span>]<span class="RktPn">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="RktSym"><a href="contract-utilities.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fguts..rkt%29._contract~3f%29%29" class="RktValLink" data-pltdoc="x">contract?</a></span></p></blockquote></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktVar">name</span><span class="hspace">&nbsp;</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._or%2Fc%29%29" class="RktValLink" data-pltdoc="x">or/c</a></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="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">Constructs a new existential contract.</div></p><p>Existential contracts accept all values when in positive positions (e.g., function
returns) and wrap them in an opaque struct, hiding the precise value.
In negative positions (e.g. function inputs),
they accepts only values that were previously accepted in positive positions (by checking
for the wrappers).</p><p>The name is used to identify the contract in error messages and defaults
to a name based on the lexical context of <span class="RktSym"><a href="#%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>.</p><p><div class="SIntrapara">For example, this contract:
</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">a</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="#%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><span class="hspace">&nbsp;</span><span class="RktVal">'</span><span class="RktVal">a</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="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="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</span><span class="hspace">&nbsp;</span><span class="RktSym">a</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktSym"><a href="data-structure-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fprivate%2Fmisc..rkt%29._any%2Fc%29%29" class="RktValLink" data-pltdoc="x">any/c</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara">describes a function that accepts the identity function (or a non-terminating function)
and returns an arbitrary value. That is, the first use of the <span class="RktSym">a</span> appears in a
positive position and thus inputs to that function are wrapped with an opaque struct.
Then, when the function returns, it is checked to see if the result is wrapped, since
the second <span class="RktSym">a</span> appears in a negative position.</div></p><p>The <span class="RktSym"><a href="#%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> construct constructor is dual to <span class="RktSym"><a href="#%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>.</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="function-contracts.html" title="backward to &quot;8.2 Function 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="Lazy_Data-structure_Contracts.html" title="forward to &quot;8.4 Lazy Data-structure Contracts&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>