[plt-scheme] contract question
Finally I decided to try contracts. I tried:
#| require one or two numbers
promise to return a number if two numbers are given
promise void if one number is given |#
#lang scheme
(provide/contract
(example
(or/c
(-> number? number? number?)
(-> number? void?))))
(define (example a (b #f))
(if b (+ a b) (void)))
This compiles, but it wont run:
Welcome to DrScheme, version 3.99.0.10-svn4feb2008 [3m].
Language: Module custom.
or/c: two arguments, (-> number? void?) and (-> number? number? number?), might both match #<procedure:example>
Why? What is wrong in my contract? May be I am wanting an impossible contract?
or/c repeats exactly what I want, but does not accept it.
I think I am missing something fundamental, but I can't find an answer in the docs.
Thanks, Jos Koot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080206/3ab82bec/attachment.html>