Excellent I fixed that and added it to the tests
Stef
I kept the functional style of union by creating a new set.
union: aSet
"Answer the union of the receiver A and aSet B. The union is defined
as { x | x in A or x in B }."
| set |
self isEmpty ifTrue: [^aSet copy].
set := Set new.
set addAll: aSet.
set addAll: self.
^ set
Sequenceable>>union: aSet
"Answer the union of the receiver A and aSet B. The union is defined
as { x | x in A or x in B }."
| stream set |
self isEmpty ifTrue: [^aSet copy ].
stream := (self species new: self size) writeStream.
set := Set new.
set addAll: aSet.
set addAll: self.
stream nextPutAll: set.
^stream contents