 
 
 (defn -step-reach-set
-  [ast]
-  (util/map-vals
-   (fn [v]
-     (->> v
-          (map (partial get ast))
-          (reduce set/union v)))))
+  [mapping]
+  (->> (for [[var deps] mapping]
+         [var (->> deps
+                   (mapv mapping)
+                   (reduce set/union deps))])
+       (into {})))
 
 
 (defn global-reach-set
   "λ {Symbol → #{Symbol}} → {Symbol → #{Symbol}}
 
   Computes the reach set for an entire program"
-  [whole-program-ast]
-  (util/fix -step-reach-set
-            (-> whole-program-ast
-                (util/map-vals reach-set))))
+  [symbol-dep-tree]
+  (util/fix -step-reach-set symbol-dep-tree))
 
 
 (defn trim-with-emit-set

  (let [new-ast (atom {:modules modules})]

    (doseq [m modules]
      (doseq [[sym ast] (get whole-program-ast m)]
        (if (pattern/def? ast)
          (if (contains? reach-set (:var ast))
            (swap! new-ast assoc-in [m sym] ast)
            (info "Discarding unused def form,"
                  (util/line ast)))
          (warn "Discarding non-def top level form,"
                (util/line ast)))))

    @new-ast))


            [oxcart.passes.defs :as defs]
            [clojure.set :as set]
            [clojure.tools.analyzer.ast :as ast]
            [taoensso.timbre :refer [info warn error debug]]))


(defn reach-set
