--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
A seq on a sorted set should be pretty efficient.
(take 3 (sorted-set 8 2 1 4 6 9 7 3))
;=> (1 2 3)
--Chouser
Does that work?
There is no guarantee that the top 10 of the overall list matches the top 10 of earlier prefixes, so the candidates that get discarded might be part of the overall top 10, and the elements that pushed them out could just be local maxima.
--
Dave
But when an element is dropped from the list, you're effectively resetting its seen-count to zero. It might be seen again, and it might (if you hadn't reset the seen-count), have ended up in the top 10.
Or have I misunderstood?
--
Dave
Ah yeah. Sorry, I'd superimposed something I was thinking about on to the original problem.
--
Dave