Thanks. The source of the problem was that I missed the note in the documentation for scheme/kw saying that <br><br>"<span class="refcolumn"><span class="refcontent">The <span class="schemesymbol"><a href="file:///C:/Program%20Files/PLT-FULL-3.99.0.26/doc/reference/lambda.html#%28form._%28%28lib._scheme/base..ss%29._lambda%29%29" class="schemesyntaxlink">lambda</a></span> and procedure-application forms of
<span class="schemesymbol">scheme/base</span> support keyword arguments, and it is
<i>not</i> compatible with the <span class="schemesymbol">mzlib/kw</span>
library."<br><br>and blithely went on thinking they were the same. I'll pay more attention to the sidenotes in the future. Thanks again.<br></span></span><br><div class="gmail_quote">On Fri, Jun 13, 2008 at 2:31 PM, Robby Findler <<a href="mailto:robby@cs.uchicago.edu">robby@cs.uchicago.edu</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">That function accepts a mandatory keyword parameter using the keyword<br>
whose name just happens to be #:optional which, I'm guessing, is not<br>
what you intended.<br>
<br>
Anyways, here is its contract:<br>
<br>
(-> any/c #:optional any/c false/c)<br>
<br>
If you wanted a function that takes either one or two arguments (as<br>
the contract suggests), I think you meant to write it like this:<br>
<br>
(define (foo a [b #f]) #f)<br>
<br>
(They keyword syntax changed a little bit from 372's (lib "kw.ss") to<br>
4.0. Maybe that's the source of the confusion?)<br>
<br>
Robby<br>
<div><div></div><div class="Wj3C7c"><br>
On Fri, Jun 13, 2008 at 1:28 PM, David Einstein <<a href="mailto:deinst@gmail.com">deinst@gmail.com</a>> wrote:<br>
> How do I write a contract for the following<br>
><br>
> (define (foo a #:optional b) #f)<br>
><br>
> I would have thought that<br>
><br>
> (provide/contract<br>
> [foo (->* (any/c) (any/c) false?)]<br>
> )<br>
><br>
> would work, but obviously I'm missing something.<br>
><br>
><br>
</div></div>> _________________________________________________<br>
> For list-related administrative tasks:<br>
> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
><br>
><br>
</blockquote></div><br>