Created
October 1, 2017 16:13
-
-
Save aaylward/730ddbac7c2be913ec12eae553d6445a to your computer and use it in GitHub Desktop.
Revisions
-
aaylward created this gist
Oct 1, 2017 .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,18 @@ (ns meetup) (def myinput { :app1 #{:t1 :t2} :app2 #{:t2 :t3} :app3 #{:t2 :t3 :t4}}) (defn update-table [outputmap table app] (assoc outputmap table (conj (or (outputmap table) #{}) app))) (defn process-tables [outputmap [app tables]] (loop [map outputmap appname app ts tables] (if (empty? ts) map (recur (update-table map (first ts) app) app (rest ts))))) (defn process-apps [app-hash] (loop [items (seq app-hash) output {}] (if (empty? items) output (recur (rest items) (process-tables output (first items))))))