Comparing collections, default behavior?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Comparing collections, default behavior?

Igor Stasenko
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.

Reply | Threaded
Open this post in threaded view
|

Re: Comparing collections, default behavior?

Noury Bouraqadi-2

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