user=> (def m1 [{:a 1 :b 2 :c 3}{:a 1 :b 2 :c 4}{:a 1 :b 4 :c 3}{:a 1 :b 4 :c
3}])
#'user/m1
user=> (require 'clojure.set)
nil
user=> (doc clojure.set/index)
-
clojure.set/index
([xrel ks])
Returns a map of the distinct values of ks in the xrel mapped to a
set of the map
On Tue, Jan 31, 2012 at 7:41 PM, ron peterson wrote:
> hello,
>
> How to group a collection of maps by multiple keys?
>
> For example
>
> (def m1 [{:a 1 :b 2 :c 3}{:a 1 :b 2 :c 4}{:a 1 :b 4 :c 3}{:a 1 :b 4 :c
> 3}])
>
> (group-by-x [:a :b] m1)
>
> I'd it like to return this:
>
> [{:a 1 :b 2}[{:a 1
hello,
How to group a collection of maps by multiple keys?
For example
(def m1 [{:a 1 :b 2 :c 3}{:a 1 :b 2 :c 4}{:a 1 :b 4 :c 3}{:a 1 :b 4 :c
3}])
(group-by-x [:a :b] m1)
I'd it like to return this:
[{:a 1 :b 2}[{:a 1 :b 2 :c 3}{:a 1 :b 2 :c 4}], {:a 1 :b 4}[{:a 1 :b
4 :c 3}{:a 1 :b 4 :c 3}]]