On Fri, Feb 4, 2011 at 9:19 AM, Mike <cki...@gmail.com> wrote: > This is probably a pretty newb question...sorry. I'm looking for the > idiomatic way to apply a seq of functions to other seqs. In other > words, a version of map that doesn't take a single f, but a seq of > them. > > (map f c1 c2 ... cn) > => ((f c11 c21 ... cn1) (f c12 c22 ... cn2) ... (f c1m c2m ... cnm)) > > (supermap fs c1 c2 ... cn) > => ((f1 c11 c21 ... cn1) (f2 c12 c22 ... cn2) ... (fk c1m c2m ... > cnm)) > > Make sense?
This does it without using juxt: (defn supermap [fs & cs] (map apply fs (apply map vector cs))) With juxt it's as Meikel wrote: (defn supermap [fs & cs] (apply map (apply juxt fs) cs)) user=> (supermap [#(* %1 %2) #(* %1 %2 %2) + -] [1 2 3 4] [5 6 7 8]) (5 72 10 -4) -- 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