On Thu, Apr 7, 2011 at 6:34 PM, Chouser <chou...@gmail.com> wrote: >>> Given a collection of functions >>> >>> (def fs [#(* % 10) #(+ % 1)]) >>> >>> and some numbers >>> >>> (def c [1 2 3]) >>> >>> How do I apply all the functions to c so that the results of one >>> function are passed to the other. In the same way -> works. Thus in >>> this case the expected result would be: 11 21 31 >> >> A typical use-case for map & comp - >> >> (map (apply comp (reverse fs)) c) >> ; => (11 21 31) > > Or if you don't want to use reverse: > > (map #(reduce (fn [x f] (f x)) % fs) c) > > Hm, BG's solution compiles no new classes, while mine generates two. > More classes is better, right? :-P
Sir Chouser is right! ;) On a more serious note, how do I find out how many classes a form compiles to? Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- 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