On 09/01/13 18:20, Jim - FooBar(); wrote:
Alex's solution is also quite idiomatic and it takes care of the transient/peristent conversion as well...It seems slightly heavier though cos you're building an intermediate vector.

CORRECTION: you'd be building MANY intermediate vectors...as many as your keys in the old-map...

In addition, as a bonus, in case your old-map is truly massive you can partition it and reduce/fold it in parallel really easily with reducers...see this for more: http://www.thebusby.com/2012/07/tips-tricks-with-clojure-reducers.html


So,

normal map -> 'reduce-kv' or 'into'/'for'
big map -> 'reduce-kv' with transients
massive map -> 'fold' (reducers)

Hope that covers everything :)

Jim

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to