Something like this?
(into {}
(for [[k v] my-map] :when (pred k v)
[(transform k) v]))
~BG
Sent from phone. Please excuse brevity.
On 9 Jan 2013 23:39, "Jonathon McKitrick" <[email protected]> wrote:
> I have a map derived from JSON data where the keys are strings. I want to
> build a new map from this one, where the new keys are based on integers
> extracted from the strings of the old keys by a regex. Not all entries
> will be transformed into the new map.
>
> In Common Lisp, I would LOOP and PUSH entries onto the map, but I need to
> learn the Clojure way of immutability.
>
> What's the best way to create this map?
>
> --
> 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
--
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