7a3907583b2d

Fix `:skip-origin t` in `within-radius`
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 14 Dec 2021 19:09:58 -0500
parents 0d62d291dfb1
children 656f2f6975bc
branches/tags (none)
files src/iterate.lisp

Changes

--- a/src/iterate.lisp	Tue Dec 14 19:09:04 2021 -0500
+++ b/src/iterate.lisp	Tue Dec 14 19:09:58 2021 -0500
@@ -530,6 +530,7 @@
     (with-gensyms (r control skip)
       `(progn
          (with ,r = ,radius)
+         (with ,skip = ,should-skip-origin)
          ,@(mapcar (lambda (ovar oval)
                      `(with ,ovar = ,oval))
                    origin-vars origin-vals)
@@ -538,13 +539,11 @@
                                     (collect `(,var :from (- ,orig ,r) :to (+ ,orig ,r))))
                           :control-var ,control)
          (next ,control)
-         ,@(unless (null should-skip-origin)
-             `((with ,skip = ,should-skip-origin)
-               (when (and ,skip
-                          ,@(iterate (for var :in (ensure-list delta-vars))
-                                     (for ovar :in origin-vars)
-                                     (collect `(= ,ovar ,var))))
-                 (next ,control))))))))
+         (when (and ,skip
+                    ,@(iterate (for var :in (ensure-list delta-vars))
+                               (for ovar :in origin-vars)
+                               (collect `(= ,ovar ,var))))
+           (next ,control))))))
 
 
 (defmacro-driver (FOR var EVERY-NTH n DO form)