As a test, I replaced the mapcat with a plain map in the slow version:
(defn collapse-slow [col pred rep]
(let [f (fn [[x & more :as xs]] (if (pred x) [rep] xs))]
(map f (partition-by #(if (pred %) true) col))))
Is that the concat you were thinking of?
Ignoring that the functions aren't equivalent anymore, it's only a 10-20%
boost.
(Let me know if I misinterpreted your suggestion.)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en