<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY 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, </FONT><FONT face=Arial size=2>Jos
Koot</FONT></DIV></BODY></HTML>