On Wednesday, February 27, 2013 10:59:33 AM UTC+1, Christophe Grand wrote: > > Now that reduce can be short-circuited, redifining every?, some and al on > top of it would yield some interesting gains: > > (defn revery? [pred coll] > (reduce (fn [t x] > (if (pred x) > t > (reduced false))) true coll)) > > (defn rblank? [s] (revery? #(Character/isWhitespace ^char %) s)) > (defn blank? [s] (every? #(Character/isWhitespace ^char %) s)) > > > Christophe >
These are very interesting results because they show that the current, supposedly "optimized" implementation involving *recur* is apparently 5x slower than plain *reduce* (the short-circuiting aspect doesn't play a role in this example). -Marko -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.