[racket] Typed Racket: Infinite Subtypes?

From: Richard Lawrence (richard.lawrence at berkeley.edu)
Date: Fri Jun 10 19:03:06 EDT 2011

Sam Tobin-Hochstadt <samth at ccs.neu.edu>
writes:

> I'll try to respond more comprehensively about the more general
> question, but for this:
>> (define-type Variable (Pair 'var Symbol))
>> (define-predicate variable? Variable)
>
> Just use a struct:
>
> (struct: variable ([s : Symbol]))
>
> Now you have `variable' and `variable?' and `variable-s', and there's
> no confusion with pairs.  That's how I'd write this code.

Ah, duh.  Thanks, Sam.  (I take it this means that the answer to my more
general question is, ``No, you can't do that,'' but I'll be interested
to read your response when you've got time to send it.)

Best,
Richard



Posted on the users mailing list.