diff --git a/piclib/built-in.scm b/piclib/built-in.scm index c916e972..9eb4d8a4 100644 --- a/piclib/built-in.scm +++ b/piclib/built-in.scm @@ -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)