             [oxcart.passes.defs :as defs]
             [clojure.set :as set]
             [clojure.tools.analyzer.ast :as ast]
-            [taoensso.timbre :refer [info warn error]]))
+            [taoensso.timbre :refer [info warn error debug]]))
 
 
 (defn reach-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))


    which is the entry point of the prorgam. It is with respect to this
    function that all other defs will be considered for elimination."
  [{:keys [modules] :as ast} {:keys [entry] :as options}]
  (let [;; Compute the {Var → #{Var}} form of the whole program
        symbol-sets (->>  (for [m     modules
                                form  (:forms (get ast m))
                                :when (pattern/def? form)]
                            [(:var form) (reach-set form)])
                          (into {})
                          global-reach-set)

        ;; The emit set is now trivially
        emit-set (get symbol-sets (resolve entry))]
    (info emit-set)
    (trim-with-emit-set ast emit-set)))
