diff --git a/piclib/scheme/base.scm b/piclib/scheme/base.scm index b3542cbd..3e512116 100644 --- a/piclib/scheme/base.scm +++ b/piclib/scheme/base.scm @@ -746,32 +746,34 @@ ;; 5.5 Recored-type definitions - (import (picrin record)) + (import (picrin record) + (scheme write)) - (define #t) ; bootstrap + (define ((default-record-writer ctor) obj) + (let ((port (open-output-string))) + (display "#.(" port) + (display (car ctor) port) + (for-each + (lambda (field) + (display " " port) + (write (record-ref obj field) port)) + (cdr ctor)) + (display ")" port) + (get-output-string port))) - (import (scheme write)) - - (define (make-record-type name ctor) - (let ((rectype (make-record ))) + (define ((boot-make-record-type ) name ctor) + (let ((rectype (make-record ))) (record-set! rectype 'name name) - (record-set! rectype 'writer (lambda (obj) - (let ((port (open-output-string))) - (display "#.(" port) - (display (car ctor) port) - (for-each - (lambda (field) - (display " " port) - (write (record-ref obj field) port)) - (cdr ctor)) - (display ")" port) - (get-output-string port)))) + (record-set! rectype 'writer (default-record-writer ctor)) rectype)) - (set! - (let (( (make-record-type ' '(name writer)))) - (record-set! '@@type ) - )) + (define + (let (( + ((boot-make-record-type #t) 'record-type '(record-type name writer)))) + (record-set! '@@type ) + )) + + (define make-record-type (boot-make-record-type )) (define-syntax define-record-constructor (ir-macro-transformer