I prefer the into version which allows to write a mapmap that preserves the map type (eg sorted or hash):
(defn mapmap [f m] (into (empty m) (for [[k v] m] [k (f v)]))) Christophe On Mon, Mar 23, 2009 at 7:53 AM, Jeff Valk <jv-li...@tx.rr.com> wrote: > > On Sun, 22 Mar 2009 at 23:27, Jeff Valk wrote: > > > Ah, golf... :-) > > > > (defn mapmap [f m] > > (into {} (for [[k v] m] [k (f v)]))) > > For the record, I think the original approach is the most clear. And it's > actually shorter. > > (defn mapmap [f m] > (zipmap (keys m) (map f (vals m)))) > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---