refactor define-record-writer

This commit is contained in:
Yuichi Nishiwaki 2014-09-04 19:14:43 +09:00
parent 85ccc30821
commit 6f40dcc5df
1 changed files with 3 additions and 3 deletions

View File

@ -1,17 +1,17 @@
(define-library (picrin record)
(import (scheme base))
(define (define-record-writer* record-type writer)
(define (set-record-writer! record-type writer)
(record-set! record-type 'writer writer))
(define-syntax define-record-writer
(syntax-rules ()
((_ (type obj) body ...)
(define-record-writer* type
(set-record-writer! type
(lambda (obj)
body ...)))
((_ type writer)
(define-record-writer* type
(set-record-writer! type
writer))))
(export define-record-writer))