[plt-scheme] mutual recursion in contracts

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri May 7 16:53:36 EDT 2004

On May 7, 2004, at 4:52 PM, David A. Herman wrote:

>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> Matthias Felleisen wrote:
>
> > That's not a question of lazy ornot, it's a question of providing a
> > form for mut rec types.
>
> Sure, laziness would just be one implementation strategy that would 
> allow for mutual recursion. But that's a good point: I don't care 
> *how* it's implemented, I just want mutually recursive contracts.
>
>> David A. Herman wrote:
> > [snip]
>>     (define-type even ([pred (union odd? #f)]))
>>     (define-type odd ([pred even?]))
>
> The first contract should be (union odd? false?). Oops. Also, I should 
> have mentioned that eta-expansion isn't an option, because the 
> contracts aren't necessarily predicates but possibly higher order 
> contract values.
>
> Maybe the easiest solution would be a library function for converting 
> a contract to a predicate so that it can be eta-

How do you get

  (letrec ([x (value-constructor1 ... x ...)]
           [y (value-constructor2 ... x ...)])
    ...)

to work?



Posted on the users mailing list.