[plt-scheme] mutual recursion in contracts

From: David A. Herman (dherman at ccs.neu.edu)
Date: Fri May 7 16:52:13 EDT 2004

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-expanded?

Dave



Posted on the users mailing list.