X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fearly-extensions.lisp;h=028707c8baea741dfa228fbe6f4c7b4c95fd553c;hb=9bdd2579f980573a74daabe03120ed64b1733b11;hp=7db471f279fd9ed57cec4f2f72b64f40d27f6050;hpb=492dce07cf27b3cbee8ce4800c938fcb884aa53e;p=sbcl.git diff --git a/src/code/early-extensions.lisp b/src/code/early-extensions.lisp index 7db471f..028707c 100644 --- a/src/code/early-extensions.lisp +++ b/src/code/early-extensions.lisp @@ -430,7 +430,6 @@ (eq (car clause) 'ignore)))) (cdr decl)))) decls)) - ;;; just like DOLIST, but with one-dimensional arrays (defmacro dovector ((elt vector &optional result) &body body) (multiple-value-bind (forms decls) (parse-body body :doc-string-allowed nil) @@ -464,6 +463,19 @@ `(with-locked-system-table (,n-table) ,iter-form) iter-form)))))) + +;;; Executes BODY for all entries of PLIST with KEY and VALUE bound to +;;; the respective keys and values. +(defmacro doplist ((key val) plist &body body) + (with-unique-names (tail) + `(let ((,tail ,plist) ,key ,val) + (loop (when (null ,tail) (return nil)) + (setq ,key (pop ,tail)) + (when (null ,tail) + (error "malformed plist, odd number of elements")) + (setq ,val (pop ,tail)) + (progn ,@body))))) + ;;;; hash cache utility