[Pharo-project] Comparing collections, default behavior?
Since Collection includes #difference: protocol, i just thought that the default equality could be expressed like following: Collection>>= otherCollection ^ (self difference: otherCollection) isEmpty In other words, if two things having no differences, then they are equal. No? :) -- Best regards, Igor Stasenko AKA sig.
On 4 févr. 2011, at 17:06, Igor Stasenko wrote:
Since Collection includes #difference: protocol,
i just thought that the default equality could be expressed like following:
Collection>>= otherCollection ^ (self difference: otherCollection) isEmpty
In other words, if two things having no differences, then they are equal. No? :)
Need to check the species too. I believe an array is different from a set even if they contain the same elements. Noury
participants (2)
-
Igor Stasenko -
Noury Bouraqadi