David T. Lewis uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-dtl.931.mcz==================== Summary ====================
Name: Collections-dtl.931
Author: dtl
Time: 11 March 2021, 5:44:43.577146 pm
UUID: 1ed239e3-d108-43c3-8b6e-de8c43d842d1
Ancestors: Collections-nice.930
Set logic methods should be discoverable, so give them a method category. Add an implementation of Collection>>symmetricDifference: so that the basic set operations of union, intersection, difference, and symmetric difference are available.
=============== Diff against Collections-nice.930 ===============
Item was changed:
+ ----- Method: Collection>>difference: (in category 'set logic') -----
- ----- Method: Collection>>difference: (in category 'enumerating') -----
difference: aCollection
"Answer the set theoretic difference of two collections."
^ self reject: [:each | aCollection includes: each]!
Item was changed:
+ ----- Method: Collection>>intersection: (in category 'set logic') -----
- ----- Method: Collection>>intersection: (in category 'enumerating') -----
intersection: aCollection
"Answer the set theoretic intersection of two collections."
^ self select: [:each | aCollection includes: each]!
Item was added:
+ ----- Method: Collection>>symmetricDifference: (in category 'set logic') -----
+ symmetricDifference: aCollection
+ "Answer the set theoretic symmetric difference of two collections."
+
+ ^ (self difference: aCollection) union: (aCollection difference: self)
+ !
Item was changed:
+ ----- Method: Collection>>union: (in category 'set logic') -----
- ----- Method: Collection>>union: (in category 'enumerating') -----
union: aCollection
"Answer the set theoretic union of two collections."
^ self asSet addAll: aCollection; yourself!
Item was changed:
+ ----- Method: HashedCollection>>union: (in category 'set logic') -----
- ----- Method: HashedCollection>>union: (in category 'enumerating') -----
union: aCollection
"Answer the set theoretic union of the receiver and aCollection, using the receiver's notion of equality and not side effecting the receiver at all."
^ self copy addAll: aCollection; yourself
!