On Mon, Oct 25, 2010 at 10:06 AM, Doug Williams
<m.douglas.willi...@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
sa...@ccs.neu.edu
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Reply via email to