Hi --

I think that it is very important to not mess up the order in the receiver when removing duplicates. This is what the algorithm in SequenceableCollection >> #withoutDuplicates does. Still, having #select: available for any kind of Collection, we might be able to move it up. Then, other kinds could optimize the implementation, like Set where no duplicates exist in the first place.

+1 for moving #withoutDuplicates up to Collection

Best,
Marcel

Am 10.06.2023 17:10:16 schrieb christoph.thiede@student.hpi.uni-potsdam.de <christoph.thiede@student.hpi.uni-potsdam.de>:

Hi all,

I was just wondering why we only define #withoutDuplicates on SequenceableCollection, since it does not depend on the order of the receiver and could be applied to other types of collections as well. For instance, Set could override it with ^self copy, Bags would be naturally covered as well, etc.

What do you think?

Best,
Christoph

---
Sent from Squeak Inbox Talk