This morning my brain is trying to figure out how to do this. I am new to Clojure and Lisp in general. I have a data structure, which is a map vector, and I want to get all the values for a particular key from all maps in another vector.
For example, suppose this is a vector of cards associated with myvec:
[ { "key1" "value1" "key2" "value2"} {"key1" "value3" "key2" "value4"} ]
and i need a vector that looks like
[ "value1" "value3" ]
consisting of all key values "key1"
The only way I could do this is
(for [i (range (count(myvec)))] ((myvec i) "key1"))
Is there an easier way? It seems like it should be.
Thanks.
source share