On Feb 22, 3:23 pm, rob levy <r.p.l...@gmail.com> wrote: > The usual intuitive options for this are reduce, zipmap, or into. You can > also write a lazily recursive solution. I wonder why there's no function in > core that lazily re-constructs the map with the results of the function? It > seems to have been discussed on the list at least once or twice. It seems > like there would have to be two versions of it, one expecting a function > with an arity of one (for just the value) and another expecting an arity of > two (key and value).
Maps aren't lazy. They would be seqs if they were lazy, and not have fast lookup by key. clojure.contrib.generic.functor/fmap updates values, and clojure.walk/ walk (and maybe post-walk) can do what you're looking for with pairs: user=> (walk (fn [[k v]] [v k]) identity {:a 1 :b 2}) {1 :a, 2 :b} -- 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