[racket] define/contract with default arguments
On 05/23/2011 02:12 PM, Jon Rafkind wrote:
> Is there a way to get `define/contract' to play nice with default
> arguments? I could see how this would be an issue in general (like
> trying to provide/contract some function defined with default arguments)
> but I was hoping `define/contract' could set things up so it would work.
>
>> (define/contract (x [a 5]) (-> number? number?) a)
Use ->*:
(define/contract (x [a 5]) (->* () (number?) number?) a)
Ryan