add do macro
This commit is contained in:
parent
62069af4f9
commit
8d1bfc026b
|
@ -259,6 +259,19 @@
|
||||||
(apply consumer (cdr res))
|
(apply consumer (cdr res))
|
||||||
(consumer 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 (boolean=? . objs)
|
||||||
(define (every pred list)
|
(define (every pred list)
|
||||||
(if (null? list)
|
(if (null? list)
|
||||||
|
|
Loading…
Reference in New Issue