From 7f7296191528be7da205fe32e31f2d79649c14bc Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Fri, 22 Apr 2016 14:26:42 -0700 Subject: [PATCH] unchoke --- beautiful-racket-lib/br/eopl.rkt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/beautiful-racket-lib/br/eopl.rkt b/beautiful-racket-lib/br/eopl.rkt index 5062b6c..03bfc03 100644 --- a/beautiful-racket-lib/br/eopl.rkt +++ b/beautiful-racket-lib/br/eopl.rkt @@ -28,15 +28,15 @@ (values rator rand)))) -(define #'(define-datatype - ( [ ] ...) ...) +(define #'(define-datatype _base-type _base-type-predicate? + (_subtype [_field _field-predicate?] ...) ...) #'(begin - (struct () #:transparent #:mutable) - (struct ( ...) #:transparent #:mutable - #:guard (λ( ... name) - (unless ( ) - (error name (format "arg ~a is not ~a" '))) ... - (values ...))) ...)) + (struct _base-type () #:transparent #:mutable) + (struct _subtype _base-type (_field ...) #:transparent #:mutable + #:guard (λ(_field ... name) + (unless (_field-predicate? _field) + (error name (format "arg ~a is not ~a" _field '_field-predicate?))) ... + (values _field ...))) ...)) (define-datatype lc-exp lc-exp?