chiark
/
gitweb
/
~mdw
/
lisp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mdw-base.lisp: Allow multiple arguments in `update-place' etc.
[lisp]
/
mdw-base.lisp
diff --git
a/mdw-base.lisp
b/mdw-base.lisp
index ab1a47c1fad4b26fd38771c9d27fd66a195d3a5d..ec869871af64b302ec008ed61d60bd71f61a8d0e 100644
(file)
--- a/
mdw-base.lisp
+++ b/
mdw-base.lisp
@@
-345,17
+345,17
@@
(defmacro with-places ((&key environment) places &body body)
;;;--------------------------------------------------------------------------
;;; Update-in-place macros built using with-places.
;;;--------------------------------------------------------------------------
;;; 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)
(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))
(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))
,x))))
(defmacro incf-after (place &optional (by 1))