<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I'm not sure why you can't use or/c (see below), but you should be able to use ->* or case->:<div><br class="webkit-block-placeholder"></div><div><div><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><div><font><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (define (example a (b #f))<br> (if b (+ a b) (void)))</span></font></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br class="webkit-block-placeholder"></span></font></div>->* specifies contracts for variable arity procedures:<br><div><br class="webkit-block-placeholder"></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (provide/contract</span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px;"> (example (->* (number?) (number?) (or/c number? void?))))</span></font></div></span><div><br class="webkit-block-placeholder"></div>case-> is intended for contracts on case-lambdas, but it should work okay here:</div><div><br></div><div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px; "> (provide/contract</span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px; "> (example (case-> (-> number? number? number?)</span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 12px; "> (-> number? void?))))</span></font></div><div><br></div><div>I thought or/c could only be used on value contracts but the documentation suggests otherwise.</div><div><br class="webkit-block-placeholder"></div></div><div><div><div><div><div><div>Cheers,</div><div><br class="webkit-block-placeholder"></div><div>-- Dave</div><div><br></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div bgcolor="#ffffff"><div><font face="Arial" size="2">Finally I decided to try contracts. I tried:</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2">#| require one or two numbers<br> promise to return a number if two numbers are given<br> promise void if one number is given |#</font></div><div> </div><div><font face="Arial" size="2">#lang scheme</font></div><div> </div><div><font face="Arial" size="2">(provide/contract<br> (example<br> (or/c<br> (-> number? number? number?)<br> (-> number? void?))))</font></div><div> </div><div><font face="Arial" size="2">(define (example a (b #f))<br> (if b (+ a b) (void)))</font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2">This compiles, but it wont run:</font></div><div> </div><div><font face="Arial" size="2">Welcome to DrScheme, version 3.99.0.10-svn4feb2008 [3m].<br>Language: Module custom.<br>or/c: two arguments, (-> number? void?) and (-> number? number? number?), might both match #<procedure:example></font></div><div><font face="Arial" size="2"></font> </div><div><font face="Arial" size="2">Why? What is wrong in my contract? May be I am wanting an impossible contract?</font></div><div><font face="Arial" size="2">or/c repeats exactly what I want, but does not accept it.</font></div><div><font face="Arial" size="2">I think I am missing something fundamental, but I can't find an answer in the docs.</font></div><div><font face="Arial" size="2">Thanks,<span class="Apple-converted-space"> </span></font><font face="Arial" size="2">Jos Koot</font></div>_________________________________________________<br> For list-related administrative tasks:<br> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br></div></span></blockquote></div><br></div></div></div></div></div></body></html>