(defn remove
"Returns an updated dependency tracker from which the namespaces
(symbols) have been removed. The ::unload and ::load lists are
populated as with 'add'."
[tracker names]
(let [{load ::load
unload ::unload
deps ::deps
:or {load (), unload (), deps (dep/graph)}} tracker
known (set (dep/nodes deps))
removed-names (filter known names)
new-deps (remove-deps deps removed-names)
changed (affected-namespaces deps removed-names)]
(assoc tracker
::deps new-deps
::unload (distinct
(concat (reverse (sort (dep/topo-comparator deps) changed))
unload))
::load (distinct
(filter (complement (set removed-names))
(concat (sort (dep/topo-comparator new-deps) changed)
load))))))