Merge pull request #438 from arthurmaciel/unless-when

Unless/when don't have alternate clause
This commit is contained in:
Justin Ethier 2021-01-22 22:17:31 -05:00 committed by GitHub
commit f8b2d5a9cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -483,15 +483,13 @@
(if (null? (cdr exp)) (error/loc "empty when" exp))
(if (null? (cddr exp)) (error/loc "no when body" exp))
`(if ,(cadr exp)
((lambda () ,@(cddr exp)))
#f))))
((lambda () ,@(cddr exp)))))))
(define-syntax unless
(er-macro-transformer
(lambda (exp rename compare)
(if (null? (cdr exp)) (error/loc "empty unless" exp))
(if (null? (cddr exp)) (error/loc "no unless body" exp))
`(if ,(cadr exp)
#f
`(if (not ,(cadr exp))
((lambda () ,@(cddr exp)))))))
(define-syntax do
(er-macro-transformer