Improve macro

This commit is contained in:
Tom Willemsen 2012-08-14 22:40:40 +02:00
parent 17d9c17d9f
commit 8681daf54a

View file

@ -5,7 +5,7 @@
(define-syntax define-view
(lambda (x)
(syntax-case x (with)
(syntax-case x ()
((_ name doc fmt fields fields* ...)
(with-syntax ((viewname
(datum->syntax
@ -14,11 +14,13 @@
(define (viewname)
doc
(map (lambda (item)
(let (#,@(map (lambda (field)
#`(#,field (cdr (assq (quote #,field) item))))
#'(fields fields* ...)))
(format #t fmt
#,@(map
(lambda (field)
#`(cdr (assq (quote #,field) item)))
#'(fields fields* ...))))
#,@(map (lambda (field)
field)
#'(fields fields* ...)))))
todo-list))
(set! view-list
(append view-list