   (let [[plan node] (add-flow plan (FilterMap. (memory->nodes memory) (pattern->deconstructor pattern)))]
     [plan [node] (pattern->vars pattern)]))
 
+(comment
+  (let [plan empty-flow-plan
+        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
+        [plan nodes-b vars-b] (recall->nodes plan (Recall. :known (->connected 'x 0)))]
+    [plan nodes-a nodes-b vars-a vars-b])
+  )
+
 ;; if clause can be calculated somehow then return a new [plan node vars] pair that calculates it
 ;; TODO make this extensible
 (defn compute->nodes [plan nodes vars {:keys [pattern]}]

                 [plan node] (add-flow plan (->FilterMap nodes filter-map-fun))]
             [plan [node] vars]))))

(defn computes->nodes [plan nodes vars computes]
    (loop [orig-nodes nodes
           plan plan

           computes-applied computes-applied
           computes-unapplied []]
      (if-let [[compute & computes-remaining] (seq computes-remaining)]
        (if-let [[new-plan new-nodes new-vars] (compute->nodes plan nodes vars compute)]
          (recur orig-nodes new-plan new-nodes new-vars computes-remaining (conj computes-applied compute) computes-unapplied)
          (recur orig-nodes plan nodes vars computes-remaining computes-applied (conj computes-unapplied compute)))
        (if (= nodes orig-nodes)
          [plan nodes vars (set computes-applied)]
          (recur nodes plan nodes vars computes-unapplied computes-applied [])))))

(comment
  (let [plan empty-flow-plan
        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
        [plan nodes-b vars-b computes-applied] (computes->nodes plan nodes-a vars-a [(Compute. (->When '[x z] "x > z"))
                                                                                     (Compute. (->Let 'z '[x y] "x + y"))
                                                                                     (Compute. (->Let 'z '[w x] "a + x"))])]
    [plan nodes-b vars-b computes-applied])
  )

(defn output->nodes [plan nodes vars {:keys [memory pattern]}]
  (assert (every? (set vars) (pattern->vars pattern)))
  (let [[plan output-node] (add-flow plan (FilterMap. nodes (pattern->constructor pattern vars)))
        plan (add-output plan output-node memory)]
    plan))

(comment
  (let [plan empty-flow-plan
        [plan nodes-a vars-a] (recall->nodes plan (Recall. :known&pretended (->edge 'x 'y)))
        [plan nodes-b vars-b computes-applied] (computes->nodes plan nodes-a vars-a [(Compute. (->When '[x z] "x > z"))
                                                                                     (Compute. (->Let 'z '[x y] "x + y"))
                                                                                     (Compute. (->Let 'z '[w x] "a + x"))])
        plan (output->nodes plan nodes-b vars-b (Output. :remembered (->connected 'x 'y)))]
    plan)
  )

(defn join->nodes [plan nodes-a vars-a computes-applied-a nodes-b vars-b computes-applied-b]
  (let [key-vars (intersection (set vars-a) (set vars-b))
