On Jan 12, 12:11 am, Mark Fredrickson <mark.m.fredrick...@gmail.com> wrote: > I can't imagine this idea will be met warmly, but I have a suggestion. > It requires ending maps and vectors as functions of keys. Instead, > make the first argument to a collection be a function which is mapped > to across the collection. Any additional arguments are passed to the > function on each invocation. For maps and hashes, this would only be > applied to the values. Keys would remain the same. > > Some examples: > ('(1 2 3) * 2) => (2 4 6) > ({:greet "hello" :farewell "goodbye"} str " Mark") => {:greet "hello > Mark" :farewell "goodbye Mark"}
Hi Mark, I find the callable map VERY useful, and would hate to lose it. You can use maps for lots of things besides keyword=>value structures, and the callable map becomes more valuable in those situations. Your first example can be written almost as succinctly with map: (map #(* % 2) '(1 2 3)) ;;=> (2 4 6) The second is a little more complicated, but still doable: (reduce (fn [m [k v]] (assoc m k (str v " Mark"))) {} {:greet "hello" :farewell "goodbye"}) ;;=> {:farewell "goodbye Mark", :greet "hello Mark"} -Stuart Sierra --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---