Collection >> #removeIdentical:
Diego Fernandez
diegof79 at gmail.com
Wed Sep 20 14:02:04 UTC 2006
It's really strange, these two works in my image (Squeak-3.9-7058):
(Set withAll: #(a b c a) ) removeAllSuchThat: [:x | x == #a ].
(OrderedCollection withAll: #(a b c a) )
removeAllSuchThat: [:x | x == #a ].
May be you can get the same effect with something like this:
(the worst case it's O(n^2) like removeAllSuchThat: in Collection)
| s |
s := Set withAll: #(a b c a).
s removeAll: (s select: [:x | x == #a ]).
It's really necesary to keep the same Collection instance (why not
simply reject:) ?
On 9/19/06, Leandro Caniglia <caniglia at dm.uba.ar> wrote:
>
>
> What's the best way to implement the method of the subject?
>
> self removeAllSuchThat: [:x | x == anObject] won't work.
>
> /Leandro
>
>
>
>
More information about the Squeak-dev
mailing list
|