Skip to content

Instantly share code, notes, and snippets.

@uvtc
Created June 28, 2012 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uvtc/3013269 to your computer and use it in GitHub Desktop.
Save uvtc/3013269 to your computer and use it in GitHub Desktop.
(ns zow.core)
(def maps [{:a 1 :b 2}
{:a 11 :b 22 :c 5}
{:c 6 :a 7}])
(defn my-merge-maps
[& maps]
(reduce (fn [accum [k v]]
(if (accum k)
(assoc accum k (concat (accum k) [v]))
(assoc accum k [v])))
{}
(apply concat maps)))
(defn -main
[]
(println (my-merge-maps maps)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment