Wracking my brain this afternoon trying to figure this one out. I'm
fairly new to Clojure and Lisp in general. I have a data structure
that is a vector of maps and I want to get all the values for a
particular key out of all of the maps into another vector.

For example, let's say this is the vector of maps bound to myvec:

[ { "key1" "value1" "key2" "value2"} {"key1" "value3" "key2"
"value4"} ]

and I want a vector that looks like

[ "value1" "value3" ]

made up of all the values of the key "key1"

The only way I could think of to do it is

(for [i (range (count(myvec)))] ((nth myvec i) "key1"))

Is there an easier way? It seems like there must be.

Thanks.

-- 
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

Reply via email to