add define-record-writer

This commit is contained in:
Yuichi Nishiwaki 2014-08-07 11:47:23 +09:00
parent 53a732e9c4
commit 75138db4db
2 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,7 @@ list(APPEND PICLIB_SCHEME_LIBS
${PROJECT_SOURCE_DIR}/piclib/scheme/base.scm ${PROJECT_SOURCE_DIR}/piclib/scheme/base.scm
${PROJECT_SOURCE_DIR}/piclib/picrin/record.scm
${PROJECT_SOURCE_DIR}/piclib/picrin/array.scm ${PROJECT_SOURCE_DIR}/piclib/picrin/array.scm
${PROJECT_SOURCE_DIR}/piclib/picrin/dictionary.scm ${PROJECT_SOURCE_DIR}/piclib/picrin/dictionary.scm
${PROJECT_SOURCE_DIR}/piclib/picrin/test.scm ${PROJECT_SOURCE_DIR}/piclib/picrin/test.scm

17
piclib/picrin/record.scm Normal file
View File

@ -0,0 +1,17 @@
(define-library (picrin record)
(import (scheme base))
(define (define-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
(lambda (obj)
body ...)))
((_ type writer)
(define-record-writer* type
writer))))
(export define-record-writer))