This code extracts all values from vector of maps.
(def vector-of-maps [{:a "1" :b "2"}{:a "3" :b "4"}])
(mapcat vals vector-of-maps)
so I get ("1" "2" "3" "4")
I want to get values only from :a to get ("1" "3")
What way can I do it ?
(def vector-of-maps [{:a "1" :b "2"} {:a "3" :b "4"}])
(map :a vector-of-maps)
yields
("1" "3")
map
will apply :a
as a function which will extract value from each value in vector-of-maps
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With