 
 
 (defn global-reach-set
-  "λ {Symbol → AST} → {Symbol → #{Symbol}}
+  "λ {Symbol → #{Symbol}} → {Symbol → #{Symbol}}
 
   Computes the reach set for an entire program"
   [whole-program-ast]

                (util/map-vals reach-set))))


(defn tree-shake-module
  [module options]
  )

(defn tree-shake
  "λ Whole-AST → options → Whole-AST

    :entry is a symbol, presumably a namespace qualified -main var,
    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 [;; First find and annotate all the defs in the program
        ast (-> ast (defs/locate-defs options))

        ;; Then compute the {Var → #{Var}} form of the whole program
        symbol-sets (->> (for [m   modules
                               sym (keys (get ast m))
                               :let [form (get-in ast [m sym])]]
                           [(:var form) (reach-set form)])
                         (into {})
                         global-reach-set)

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