>> http://code.google.com/p/clojure/issues/detail?id=95
I just looked over this code. You can speed it up even more by
manually encoding the loop, rather than using reduce.
(defn faster-max-key
([k x] x)
([k x & more]
(loop [x x,
kx (k x)
s more]
(if-not s x
(let [y (first s),
ky (k y)]
(if (> kx ky)
(recur x kx (next s))
(recur y ky (next s))))))))
5x faster than the one at the code.google.com link above in my own benchmarks.
--
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