On Feb 17, 2012, at 2:29 PM, Alan Malloy wrote:

> Lazy sequences implement java.util.List, which has a .size method.
> clojure.lang.APersistentVector/doEquiv (and doEquals) attempts to
> optimize when it sees it is being compared to something with a .size
> or .count method, by comparing sizes before doing the hard work of
> comparing elements. But this is not much of an optimization when
> the .size method is infinitely slow! Perhaps an additional test for
> lazy sequences should be added to these methods, but I'm certain the
> issue is more complicated than it appears after my cursory
> exploration, so that may well have other issues.

Thanks for the explanation; I guessed it might be something like that. It seems 
a dubious optimization to do an initial size check on collections for which 
size/count are O(n), even when n isn't infinite!

-- 
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

Reply via email to