|
|
@ -31,8 +31,8 @@
|
|
|
|
(define #'(define-datatype <base-type> <base-type-predicate?>
|
|
|
|
(define #'(define-datatype <base-type> <base-type-predicate?>
|
|
|
|
(<subtype> [<field> <field-predicate?>] ...) ...)
|
|
|
|
(<subtype> [<field> <field-predicate?>] ...) ...)
|
|
|
|
#'(begin
|
|
|
|
#'(begin
|
|
|
|
(struct <base-type> () #:transparent)
|
|
|
|
(struct <base-type> () #:transparent #:mutable)
|
|
|
|
(struct <subtype> <base-type> (<field> ...) #:transparent
|
|
|
|
(struct <subtype> <base-type> (<field> ...) #:transparent #:mutable
|
|
|
|
#:guard (λ(<field> ... name)
|
|
|
|
#:guard (λ(<field> ... name)
|
|
|
|
(unless (<field-predicate?> <field>)
|
|
|
|
(unless (<field-predicate?> <field>)
|
|
|
|
(error name (format "arg ~a is not ~a" <field> '<field-predicate?>))) ...
|
|
|
|
(error name (format "arg ~a is not ~a" <field> '<field-predicate?>))) ...
|
|
|
|