[squeak-dev] set equality has changed :-(

Eliot Miranda eliot.miranda at gmail.com
Tue Apr 19 16:11:57 UTC 2016


Hi Marcel,

On Tue, Apr 19, 2016 at 12:32 AM, Tobias Pape <Das.Linux at gmx.de> wrote:

>
> On 19.04.2016, at 08:23, marcel.taeumel <Marcel.Taeumel at hpi.de> wrote:
>
> > Hi Eliot,
> >
> > try this:
> > (Set with: #module) includesAllOf: (IdentitySet with: #module).
> >
> > This is "hasEqualElements:" for all kinds of collections.
>
> But this is not reflexive, right?
>
> (Set withAll: #(module moep)) includesAllOf: (IdentitySet with: #module)
>

How about

Set>>hasEqualElements: aCollection
     ^aCollection size = self size and: [aCollection noneSatisfy:
[:element| (self includes: element) not]


Again it's not reflexive with sequenceable collections, but unlike
includesAllOf: it meets the specification ;-).



> >
> > Best,
> > Marcel
>
>
>
>
>


-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160419/d9b85aa7/attachment.htm


More information about the Squeak-dev mailing list