Here is what I came up with ...
(let [d (split (slurp "data") #",")]
(->> d
(apply hash-map)
(clojure.walk/keywordize-keys)
(clojure.contrib.generic.functor/fmap read-string)))
Sunil.
On Fri, Dec 3, 2010 at 7:52 PM, Anclj <[email protected]> wrote:
> Hi,
>
> I have a string of data and I would like to get a map {:key
> value, :key value, …}
>
> How could I do that?
>
> I've got:
>
> user> (split (slurp "data") #",")
> ["0" "2" "1" "5" "2" "8" "3" "15" "4" "9"]
>
> And I would like:
> {:0 2, :1 5, :2 8, :3 15, :4 9}
>
> Any idea?
> Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]<clojure%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en