Clojure Array of Maps Extract Keyword Values

Array of Maps Get Keyword Values in Clojure

[quads id=8]

Hi! Here I shows you How to Extract Keyword Values in Array of Maps in Clojure Programming Language.

And to easily achieve this outcome I simply make use of the map Functions.

Especially relevant: we can easily getting this Result because in Clojure you can use Keywords as Functions.

Featured
  1. Get Keyword Values in Array of Maps

    So, for instance, if we have a most populated Cities Array of Maps like:

    (def cities
    [
    {:name "Tokyo" :pop 37.5}
    {:name "Delhi" :pop 28.5}
    {:name "Shangai" :pop 25.5}
    {:name "Sao Paulo" :pop 21.5}
    {:name "Mexico City" :pop 21.5}
    {:name "Cairo" :pop 20}
    ])
    We apply a “map” on the “name” Keyword on cities like:
    (map :name cities)
    => ("Tokyo" "Delhi" "Shangai" "Sao Paulo" "Mexico City" "Cairo")

Leave a Reply

Your email address will not be published. Required fields are marked *