[racket-dev] [plt] Push #28213: master branch updated

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Fri Feb 21 00:15:01 EST 2014

On 2014-02-20 21:25:59 -0700, Neil Toronto wrote:
> You mean something like this would work?
>
>   (define-type (Leaf1 X) (Pair (Leaf2 X) (Leaf2 X)))
>   (define-type (Leaf2 X) (U X (Pair (Leaf1 X) (Leaf1 X))))

Yes, that should work. Here's an example interaction from my development
branch:

  Welcome to Racket v5.90.0.10.
  -> (let () (define-type (Leaf1 X) (Pair (Leaf2 X) (Leaf2 X)))
             (define-type (Leaf2 X) (U X (Pair (Leaf1 X) (Leaf1 X))))
             (define: x : (Leaf1 Integer) (cons 3 (cons (cons 5 5) (cons 6 5))))
             x)
  - : (Leaf1 Integer)
  '(3 (5 . 5) 6 . 5)

Cheers,
Asumu

Posted on the dev mailing list.