[racket-dev] Release for v5.0.2 has begun
On Mon, Oct 25, 2010 at 10:06 AM, Doug Williams
<m.douglas.williams at gmail.com> wrote:
>
> (case-> (->r ((r random-source?)
> (a real?)
> (b (>/c a)))
> real?)
> (->r ((a real?)
> (b (>/c a)))
> real?)))
>
> I'm not sure that one can be easily rewritten in the current contract
> system. [I think I would have to move the b > a constraint into the code
> itself in the current contract system. Or, change the argument order and
> break backward compatibility.]
This can be written as a dependent contract, but with worse error messages.
(->i ([r/a (or/c random-source? real?)] [a/b real?])
([b/opt (r/a a/b) (if (random-source? r/a) (>/c a/b) none/c)])
[result real?])
--
sam th
samth at ccs.neu.edu