Coverting a vector of maps to map of maps in clojure

Posted by Osman on Stack Overflow See other posts from Stack Overflow or by Osman
Published on 2010-06-16T09:44:17Z Indexed on 2010/06/16 9:52 UTC
Read the original article Hit count: 225

Filed under:

Hi,

I've a vector of maps like this:


[
 {:categoryid 1, :categoryname "foo" } 
 {:categoryid 2, :categoryname "bar" } 
 {:categoryid 3, :categoryname "baz" }
]

and would like to generate a map of maps like this for searching by categoryname


{
"foo" {:categoryid 1, :categoryname "foo" }, 
"bar" {:categoryid 2, :categoryname "bar" }, 
"baz" {:categoryid 3, :categoryname "baz" }
}

How can i achieve?

© Stack Overflow or respective owner

Related posts about clojure