           (do
             (apush dup-value-ixes dup-value-ix)
             (apush dup-var-ixes ix))
-          (do
-            (apush var-ixes ix)
-            (swap! seen? assoc value ix)))
+          (swap! seen? assoc value ix))
         (do
           (apush constant-values value)
           (apush constant-ixes ix))))
-    `(pattern->deconstructor* ~constant-values ~constant-ixes ~var-ixes ~dup-value-ixes ~dup-var-ixes)))
-
-(defn pattern->deconstructor* [constant-values constant-ixes var-ixes dup-value-ixes dup-var-ixes]
+    `(pattern->deconstructor* ~constant-values ~constant-ixes ~dup-value-ixes ~dup-var-ixes)))
+
+(defn pattern->deconstructor* [constant-values constant-ixes dup-value-ixes dup-var-ixes]
   (fn [fact]
     (let [source (.-values fact)]
       (loop [i 0]

;; PATTERNS

(defn pattern->vars [pattern]
  (vec (distinct (filter symbol? (.-values pattern)))))

(defn pattern->filter [pattern]
  `(pattern->filter* ~(.-shape pattern)))

             [plan [node] (pattern->vars pattern)])
    Compute (let [{:keys [pattern]} clause]
              (condp = (.-shape pattern)
                Let (when (every? (conj (set vars) '_) (:vars pattern))
                      (let [fun&args (if (contains? (set vars) (:name pattern))
                                       `(when-let->fun ~(ix-of vars (:name pattern)) ~vars ~(:expr pattern))
                                       `(let->fun ~vars ~(:expr pattern)))
                            [plan node] (add-flow plan (->FilterMap nodes fun&args))]
                        [plan [node] (conj vars (:name pattern))]))
                When (when (every? (conj (set vars) '_) (:vars pattern))
                       (let [[plan node] (add-flow plan (->FilterMap nodes `(when->fun ~vars ~(:expr pattern))))]
                         [plan [node] vars]))))
    Output (let [{:keys [memory pattern]} clause
                 _ (assert (every? (conj (set vars) '_) (pattern->vars pattern)))
                 [plan output-node] (add-flow plan (FilterMap. nodes (pattern->constructor vars pattern)))
                 output-memory (case memory
                                 :pretended :known|pretended
