Hi, I'm trying to transform a sequence of data to a map, and I'm using the
following pattern.
(def data [ {:id 1, :name "foo"}, {:id 2, :name "bar"}])
(zipmap (map #(:id %) data) data)
; result: {1 {:id 1, :name "foo"}, 2 {:id 2, :name "bar"}}
Is this the most idiomatic way to accomplish this transformation? If not,
what is?
Thanks,
Travis
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.