On Oct 20, 5:52 am, Meikel Brandmeyer <m...@kotka.de> wrote: > > (defn multi-filter [filters coll] > > (reduce > > (fn [res e] > > (map (fn [f r] (if (f e) (conj r e) r)) > > filters > > res)) > > (repeat (count filters) []) > > coll)) > > I think this basically equivalent to the juxt solution. Besides your > are using sequence, where juxt uses vectors directly. Maybe that is a > bit faster? Dunno.
Where do I use a sequence? reduce? or this line? > > (repeat (count filters) []) Should I wrap it in (vec ...) or is there a better way? > Stylistic: you should not put the closing parens on dedicated lines. > They are normally collected on the last line. While this is only a > style issue, you should get used to it, since 99.9% of all code at in > the wild will use that style... I've read it many times, and I've tried to do it. But how do you solve this practical problem: When you need to insert something in the middle, how do you find the right closing paren where to split it? I use TextMate if it matters. > Use next instead of the seq-rest combination. Thanks, source is cleaner now, but perf is exactly the same. Not surprisingly I guess as next is defined as (seq (rest x)) :-) . - Dmitry P.S. Why does it take almost 2 DAYS for my messages to appear in this group? I've sent two last messages on Sunday afternoon. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---