On Tue, Jan 31, 2012 at 7:41 PM, ron peterson <peterson.ron...@gmail.com> 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 :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}]] > > Thanks. R.
(group-by #(select-keys % [:a :b]) m1) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en