mdw-base.lisp: Allow multiple arguments in `update-place' etc.
[lisp] / mdw-base.lisp
index ab1a47c..ec86987 100644 (file)
 ;;;--------------------------------------------------------------------------
 ;;; Update-in-place macros built using with-places.
 
-(defmacro update-place (op place arg &environment env)
-  "Update PLACE with the value of OP PLACE ARG, returning the new value."
+(defmacro update-place (op place &rest args &environment env)
+  "Update PLACE with (OP PLACE . ARGS), returning the new value."
   (with-places (:environment env) (place)
-    `(setf ,place (,op ,place ,arg))))
+    `(setf ,place (,op ,place ,@args))))
 
-(defmacro update-place-after (op place arg &environment env)
-  "Update PLACE with the value of OP PLACE ARG, returning the old value."
+(defmacro update-place-after (op place &rest args &environment env)
+  "Update PLACE with (OP PLACE . ARGS), returning the old value."
   (with-places (:environment env) (place)
     (with-gensyms (x)
       `(let ((,x ,place))
-        (setf ,place (,op ,x ,arg))
+        (setf ,place (,op ,x ,@args))
         ,x))))
 
 (defmacro incf-after (place &optional (by 1))