123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- (define-syntax define-record-type
- (syntax-rules ()
- ((define-record-type ?type
- (?constructor ?arg ...) . ?more)
- (define-record-type ?type ?type
- (?constructor ?arg ...) . ?more))
- ((define-record-type ?id ?type
- (?constructor ?arg ...)
- (?field . ?field-stuff)
- ...)
- (begin (define ?type (make-record-type '?id '(?field ...)))
- (define ?constructor (record-constructor ?type '(?arg ...)))
- (define-accessors ?type (?field . ?field-stuff) ...)))
- ((define-record-type ?id ?type
- (?constructor ?arg ...)
- ?pred
- ?more ...)
- (begin (define-record-type ?id ?type
- (?constructor ?arg ...)
- ?more ...)
- (define ?pred (record-predicate ?type))))))
- (define-syntax define-accessors
- (syntax-rules ()
- ((define-accessors ?type ?field-spec ...)
- (begin (define-accessor ?type . ?field-spec) ...))))
- (define-syntax define-accessor
- (syntax-rules ()
- ((define-accessor ?type ?field ?accessor)
- (define ?accessor (record-accessor ?type '?field)))
- ((define-accessor ?type ?field ?accessor ?modifier)
- (begin (define ?accessor (record-accessor ?type '?field))
- (define ?modifier (record-modifier ?type '?field))))
- ((define-accessor ?type ?field)
- (begin))))
|