I did a similar hack and after I defined two methods on each of the
class Set and Sequenceable.
Stef
Hi,
I have a method union: with which the tests works fine.
Here it is:
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].
self isSequenceable
ifTrue: [stream := (self species new: self size)
writeStream]
ifFalse: [stream := (OrderedCollection new: self size)
writeStream]. "uses a stream to work also for Array."
set := Set new.
set addAll: aSet.
set addAll: self.
stream nextPutAll: set.
^stream contents
Romain
-----Message d'origine-----
De : moose-dev-bounces(a)iam.unibe.ch [mailto:moose-dev-bounces@iam.unibe.ch
]
De la part de Stéphane Ducasse
Envoyé : samedi 14 juin 2008 09:35
À : Related to the development of Moose and other related tools
Objet : [Moose-dev] Re: did union: work in the past?
Hi Stef,
The code was always somehow broken because it tries to do too many
things and putting Array and Set in the same pot does not work
well. I
do not know how to fix it to work with everything, but for now I am
only using it for SequencebleCollection anyway. The test is red just
to keep a reminder.
hani is using sets but apparently is not able to send email to public
forum. So it really helps.
So I will fix it for Array and Set with a hack.
Stef
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev