I have a vector of maps
cards_vector = [{...} {...} ...]
and an atom
(def cards_map (atom {})
For each map in cards_vector
, I want to add the map to cards_map with key card-n
, where n increments from 1 to count(cards_vector)
. So, cards-map
should return
{:card-1 {...}
:card-2 {...}
...
:card-n {...}}
:card-X
as keys - what else would be incard-maps
? Also please add the code you have tried and how it failed so we can improve on it. Right now it's not clear, what you are struggling with (hints:map-indexed
,reset!
,keyword
) – cfrick(zipmap (map #(keyword (str "card-" (inc %))) (range)) data)
– leetwinski