On 22.03.2009, at 21:10, Jon Nadal wrote: > I often need to map a function over the values of a map while > preserving keys--something like: ... > Is there a more concise way to do this in Clojure? If not, is this > something that might be worth putting in the contrib?
Look at clojure.contrib.generic.functor/fmap. It does what you need for maps, for all the other Clojure collections (where it works like map except that its return value is a collection of the same type as the input value), and you can implement it for any type you define yourself, e.g. a tree structure. Konrad. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---