summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-03 19:03:13 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-03 19:03:13 +0200
commit92a3142b212589ff9da84347b72e679d0827efd7 (patch)
tree584754895880e9b399a6e8bac4b88c782d542444
parent172fe17e991e5cdff87a0d794bcb7272e4824c95 (diff)
Add MULTIPLE-VALUE-SETQ.
-rw-r--r--control-flow.lisp11
1 files changed, 8 insertions, 3 deletions
diff --git a/control-flow.lisp b/control-flow.lisp
index f676c08..56a1542 100644
--- a/control-flow.lisp
+++ b/control-flow.lisp
@@ -19,8 +19,8 @@
(in-package #:common-lisp)
(export '(identity constantly complement tagbody go block return-from
- return defconstant prog prog* macrolet flet prog1 prog2
- labels))
+ return defconstant prog prog* macrolet flet prog1 prog2 labels
+ multiple-value-bind multiple-value-list multiple-value-setq))
(defun identity (x)
@@ -217,7 +217,12 @@
(defmacro multiple-value-list (expression)
`(multiple-value-call #'list ,expression))
-
(defmacro multiple-value-bind ((&rest vars) expression &body forms)
`(destructuring-bind ,vars (multiple-value-list ,expression)
,@forms))
+
+(defmacro multiple-value-setq ((&rest vars) expression)
+ (let ((syms (mapcar (lambda (x) (gensym)) vars)))
+ `(destructuring-bind ,syms (multiple-value-list ,expression)
+ (setq ,@(mapcan #'list vars syms))
+ ,(first syms))))