Created
March 3, 2015 21:21
-
-
Save bts/bda3547ceb51f06d808a to your computer and use it in GitHub Desktop.
Revisions
-
bts revised this gist
Mar 3, 2015 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ (defn topo-sort "Provided a map of values to their dependencies, returns a seq of the values sorted topologically. Adapted from code by cgrande at: https://groups.google.com/forum/#!topic/clojure/-sypb2Djhio" [deps] (mapcat #(for [[u vs] % :when (empty? vs)] -
bts created this gist
Mar 3, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ (defn topo-sort "Provided a map of values to their dependencies, returns a seq of the values sorted topologically. Adapted from code by cgrande at: https://groups.google.com/forum/#!topic/clojure/-sypb2Djhio" [deps] (mapcat #(for [[u vs] % :when (empty? vs)] u) (take-while seq (iterate (fn [deps] (into {} (for [[u vs] deps :when (seq vs)] [u (mapcat deps vs)]))) deps))))