   [graph x y]
   (contains? (transitive-dependents graph x) y))
 
-(defn topo-comparator
-  "Returns a comparator which produces a topographical sort based on
+(comment
+  ;; These don't work. You can't implement topological sort using a
+  ;; comparison sort.
+  (defn topo-comparator
+    "Returns a comparator which produces a topographical sort based on
   the dependencies in graph."
-  [graph]
-  (comparator (partial dependent? graph)))
+    [graph]
+    (comparator (partial dependent? graph)))
 
-(defn topo-sort
-  "Returns a topographically-sorted sequence of the items in coll
+  (defn topo-sort
+    "Returns a topographically-sorted sequence of the items in coll
   using dependencies in graph."  
-  [graph coll]
-  (sort (topo-comparator graph) coll))
+    [graph coll]
+    (sort (topo-comparator graph) coll))
 
-(defn topo-sort-by
-  "Returns a topographically-sorted sequence of the items in coll by
+  (defn topo-sort-by
+    "Returns a topographically-sorted sequence of the items in coll by
   comparing (keyfn item) using dependencies in graph."
-  [graph keyfn coll]
-  (sort-by keyfn (topo-comparator graph) coll))
+    [graph keyfn coll]
+    (sort-by keyfn (topo-comparator graph) coll)))
 
 (comment
   ;; example usage: building a graph like:

  (depend [graph key dep]
    "Returns a new graph with a dependency from key to dep (\"key depends
    on dep\"). Forbids circular dependencies.")
  (remove-all [graph key]
    "Returns a new dependency graph with all references to key removed.")
  (remove-key [graph key]
    "Removes the key from the dependency graph without removing it as a
    dependency of other keys."))

(defn- remove-from-map [amap x]
  (reduce (fn [m [k vs]]


(declare depends?)

(def set-conj (fnil conj #{}))

(deftype MapDependencyGraph [dependencies dependents]
  DependencyGraph
  (immediate-dependencies [graph key]
