File: seqlet.lisp

package info (click to toggle)
araneida 0.90.1-dfsg-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 700 kB
  • ctags: 643
  • sloc: lisp: 4,878; perl: 166; sh: 109; makefile: 34
file content (17 lines) | stat: -rw-r--r-- 637 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(in-package :araneida)

(defmacro seqlet (binding-forms &body body)
  "Perform each of BINDING-FORMS sequentially in a lexical environment
in which all the variables in BINDING-FORMS are visible.  Stop if any
binding evaluates to NIL, setting all subsequent variables to NIL.
Evaluate the body in this environment"
  (let ((vars (mapcar #'car binding-forms)))
    (labels ((foo (forms)
                  (if forms
                      `((setf ,(caar forms) ,(cadar forms))
                        (when ,(caar forms) ,@(foo (cdr forms))))
                    '())))
      `(let ,vars
         ,@(foo binding-forms)
         ,@body))))