Let `zapf` take many pairs
author |
Steve Losh <steve@stevelosh.com> |
date |
Mon, 08 Aug 2016 13:39:27 +0000 |
parents |
5dda89e955a3
|
children |
a25df85e26e5
|
branches/tags |
(none) |
files |
losh.lisp |
Changes
--- a/losh.lisp Sun Aug 07 13:54:42 2016 +0000
+++ b/losh.lisp Mon Aug 08 13:39:27 2016 +0000
@@ -210,9 +210,11 @@
"Multiply `place` by `n` in-place."
`(zap% ,place #'* % ,n))
-(defmacro zapf (place function)
- "Update `place` with the result of calling `function` on it."
- `(zap% ,place ,function %))
+(defmacro zapf (&rest args)
+ "Zap each place with each function."
+ `(progn
+ ,@(iterate (for (place function) :on args :by #'cddr)
+ (collect `(zap% ,place ,function %)))))
;;;; Hash Tables