> I agree with Nicolas, but I think that it's really important that we > have this discussion, reach a consensus, and them implement it! > > That's why I posted the message here rather than just posting a bug > report. > > There used to be a method called hasSameElementsAs: (now called, > inexplicably, sameElements:) that could be pressed into service so > that two intervals, or an array and and interval, can have the same > elements but still be unequal. But the role of species was to define > when things could be equal... > > Maybe we need a method "hasSameSequenceOfElementsAs:" which would be > applicable to any pair of sequenceable collections, as well as being > faster to implement, than sameElements: (which is currently quadratic).
I assume that by quadratic you mean a quadratic number of compares. If you implement hasSameElementsAs: by putting the elements of at least one of your collections into a set and assume the include: operation for sets is O(1) compares then the cost of hasSameElementsAs: is linear compares. If you want to count duplicates then you need to use bags instead of sets. Perhaps you already knew this. Ralph Boland _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
