Created
July 29, 2010 20:43
-
-
Save paulosuzart/499183 to your computer and use it in GitHub Desktop.
This file contains 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 characters
(ns deps) | |
(def projects {:ProjectA {:deps [:ProjectB] | |
:desc "Web tier"} | |
:ProjectB {:desc "Service tier"} | |
:ProjectC {:deps [:ProjectB] | |
:desc "Persistence"}}) | |
(defn dep [s name sup] | |
(println "ini" s name sup) | |
(if (contains? s name) | |
s | |
(if (contains? sup :deps) | |
(conj (reduce #(dep (set %1) %2 (%2 projects)) s (:deps sup)) name) | |
(cons name (reverse s))))) | |
(let [todep | |
(reduce #(dep (set %1) %2 (%2 projects)) #{} (keys projects))] | |
(println todep)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment