SRFI 61 port

svn: r1702
This commit is contained in:
Chongkai Zhu 2005-12-27 19:51:25 +00:00
parent 6745d9c651
commit af9b25ff0f

View File

@ -11,31 +11,20 @@
(if #t (begin else1 else2 ...))) (if #t (begin else1 else2 ...)))
((_ (test => receiver) more-clause ...) ((_ (test => receiver) more-clause ...)
(let ((t test)) (let ((t test))
(cond/maybe-more t (if t
(receiver t) (receiver t)
more-clause ...))) (my-cond more-clause ...))))
((_ (generator guard => receiver) more-clause ...) ((_ (generator guard => receiver) more-clause ...)
(call-with-values (lambda () generator) (call-with-values (lambda () generator)
(lambda t (lambda t
(cond/maybe-more (apply guard t) (if (apply guard t)
(apply receiver t) (apply receiver t)
more-clause ...)))) (my-cond more-clause ...)))))
((_ (test) more-clause ...) ((_ (test) more-clause ...)
(let ((t test)) (or test (my-cond more-clause ...)))
(cond/maybe-more t t more-clause ...))) ((_ (test body ...) more-clause ...)
((_ (test body1 body2 ...) more-clause ...) (if test
(cond/maybe-more test (begin body ...)
(begin body1 body2 ...) (my-cond more-clause ...)))
more-clause ...))
((_) ((_)
(cond)))) (void)))))
(define-syntax cond/maybe-more
(syntax-rules ()
((_ test consequent)
(if test
consequent))
((_ test consequent clause ...)
(if test
consequent
(my-cond clause ...))))))