allow `else` and `=>` keyword in `case`

This commit is contained in:
Sunrim KIM (keen) 2014-05-27 13:24:59 +09:00
parent d71666624b
commit 0fea822ac0
1 changed files with 8 additions and 4 deletions

View File

@ -263,10 +263,14 @@
,(let loop ((clauses clauses))
(if (null? clauses)
#f
`(,(r 'if) (,(r 'or)
,@(map (lambda (x) `(,(r 'eqv?) ,(r 'key) (,(r 'quote) ,x)))
(caar clauses)))
(begin ,@(cdar clauses))
`(,(r 'if) ,(if (compare (r 'else) (caar clauses))
'#t
`(,(r 'or)
,@(map (lambda (x) `(,(r 'eqv?) ,(r 'key) (,(r 'quote) ,x)))
(caar clauses))))
,(if (compare (r '=>) (cadar clauses))
`(,(r 'begin) ,@(cddar clauses))
`(,(r 'begin) ,@(cdar clauses)))
,(loop (cdr clauses))))))))))
(define-syntax syntax-error