add do macro

This commit is contained in:
Yuichi Nishiwaki 2013-11-14 17:41:03 +09:00
parent 62069af4f9
commit 8d1bfc026b
1 changed files with 13 additions and 0 deletions

View File

@ -259,6 +259,19 @@
(apply consumer (cdr res))
(consumer res))))
(define-macro (do bindings finish . body)
`(let loop ,(map (lambda (x)
(list (car x) (cadr x)))
bindings)
(if ,(car finish)
(begin ,@(cdr finish))
(begin ,@body
(loop ,@(map (lambda (x)
(if (null? (cddr x))
(car x)
(car (cddr x))))
bindings))))))
(define (boolean=? . objs)
(define (every pred list)
(if (null? list)