aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-07-15 17:10:33 -0500
committerColin Okay <colin@cicadas.surf>2022-07-15 17:10:33 -0500
commit5654b8b4c30fd783dd1d1d1eb716e4f21c0ac83e (patch)
tree0a3a8513f2159538835f2b4eba2d1f1f2a7639c6 /src/utils.lisp
parentb70a404c640785010ecad52af29b4a96184b2c7e (diff)
[bugfix] in ww::setf-many; [example] fiddling with example 10
Diffstat (limited to 'src/utils.lisp')
-rw-r--r--src/utils.lisp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/utils.lisp b/src/utils.lisp
index 0f268be..9e1e46b 100644
--- a/src/utils.lisp
+++ b/src/utils.lisp
@@ -105,9 +105,15 @@ the path."
(defmacro setf-many (&rest places-and-value)
"e.g. (setf-many a b c 10) would set a b and c to 10"
- (let ((value-form
- (first (last places-and-value))))
- `(setf ,@(butlast places-and-value) ,value-form)))
+ (let* ((value-form
+ (first (last places-and-value)))
+ (value
+ (gensym))
+ (clauses
+ (loop for place in (butlast places-and-value)
+ append `(,place ,value))))
+ `(let ((,value ,value-form))
+ (setf ,@clauses))))
(defmacro with-line