I'm trying to learn clojure.
I am calling a function which is returning me an array of strings..
If I do:
(let [items (get-all-items)]
(println (type items))
(items))
the type of items is shown as class clojure.lang.PersistentVector where as the items value is like so:
[["Dogs"] ["Cats"] ["Capybaras"] ["Pygmy Hedgehogs"]]
I would like to convert this to a map in a format like this:
{ "Dogs" "Cats" "Capybaras" "Pygmy Hedgehogs" }
Does that make sense? Clojure maps can contain list of strings right?
I am only doing this because if I have it as a map, I can check if I have a pet in the list like this:
(contains? pets "Dogs")
; assuming the map is stored in pets variable
that fails if pets is a vector.
So If I can convert that to maps, how do I convert it? if not, how do I search for something in the vector?
(I like working with maps so I'd rather have maps - unless there is a strong reason not to do so)
ps: I've tried converting with into but that doesn't work either.