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?

Nicolas Cellier
2011/2/4 Igor Stasenko <[hidden email]>:
> 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? :)
>

Let's presume difference is defined compatibly to this goal.
Equality would answer false at first difference instead of collecting
all the differences first.

Nicolas

>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>