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 ...)))
((_ (test => receiver) more-clause ...)
(let ((t test))
(cond/maybe-more t
(if t
(receiver t)
more-clause ...)))
(my-cond more-clause ...))))
((_ (generator guard => receiver) more-clause ...)
(call-with-values (lambda () generator)
(lambda t
(cond/maybe-more (apply guard t)
(if (apply guard t)
(apply receiver t)
more-clause ...))))
(my-cond more-clause ...)))))
((_ (test) more-clause ...)
(let ((t test))
(cond/maybe-more t t more-clause ...)))
((_ (test body1 body2 ...) more-clause ...)
(cond/maybe-more test
(begin body1 body2 ...)
more-clause ...))
(or test (my-cond more-clause ...)))
((_ (test body ...) more-clause ...)
(if test
(begin body ...)
(my-cond more-clause ...)))
((_)
(cond))))
(define-syntax cond/maybe-more
(syntax-rules ()
((_ test consequent)
(if test
consequent))
((_ test consequent clause ...)
(if test
consequent
(my-cond clause ...))))))
(void)))))