public
Last active — forked from puredanger/gist:295099

  • Download Gist
gistfile1.clj
Clojure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
; What function can I put as FOO here to yield true
; Tried: hash-set, conj, concat
 
 
(defn kv [bag [k v]]
(update-in bag [k] conj v))
 
 
(defn mergeMatches [propertyMapList]
"Take a list of maps and merges them combining values into a set"
(reduce #(reduce kv %1 %2) {} in))
(def in
(list
{:a 1}
{:a 2}
{:a 3}
{:b 4}
{:b 5}
{:b 6} ))
;; at the REPL
;user> (mergeMatches in)
;returns this map {:b (6 5 4), :a (3 2 1)}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.