[bugfix] guard is still broken

This commit is contained in:
Yuichi Nishiwaki 2015-07-09 04:13:35 +09:00
parent 2fb17afdfc
commit ca33c6f425
1 changed files with 6 additions and 3 deletions

View File

@ -84,7 +84,8 @@
(and (list? clause) (= (length clause) 3) (equal? #'=> (list-ref clause 1))))))
(if (null? clauses)
reraise
(let ((clause (car clauses)))
(let ((clause (car clauses))
(rest (cdr clauses)))
(cond
((else? clause)
#`(begin #,@(cdr clause)))
@ -92,11 +93,13 @@
#`(let ((tmp #,(list-ref clause 0)))
(if tmp
(#,(list-ref clause 2) tmp)
(guard-aux #,reraise #,@(cdr clauses)))))
(guard-aux #,reraise #,@rest))))
((= (length clause) 1)
#`(or #,(car clause) (guard-aux #,reraise #,@rest)))
(else
#`(if #,(car clause)
(begin #,@(cdr clause))
(guard-aux #,reraise #,@(cdr clauses)))))))))
(guard-aux #,reraise #,@rest))))))))
(define-syntax (guard formal . body)
(let ((var (car formal))