Scheme (Racket) newbie here.
I am reading this book: Programming Languages Application and Interpretation by Shriram Krishnamurthi.
I installed the plai-typed package.
The book has this define-type on page 6:
(define-type AE?
[num (n number?)]
[add (lhs AE?)(rhs AE?)]
[sub (lhs AE?)(rhs AE?)])
When I enter that in Racket, it complains that there must be colon between n
and number?
, and the type must be number
not number?
I made the changes to define-type:
(define-type AE
[num (n : number)]
[add (lhs : AE)(rhs : AE)]
[sub (lhs : AE)(rhs : AE)])
Racket seems to like this.
So, is every example in the book incorrect?
Is there a way to get Racket to accept the first version of define-type? Or, do I need to modify every example in the book?