thanks I was thinking more about collectUnionAsSet: as an implementation
Sted
On Jun 18, 2008, at 1:11 AM, Adrian Kuhn wrote:
Pay attention, collectAsSet is already there and implemented as
collectAsSet: aBlock (self collect: aBlock) asSet
whereas a hypothetical collectUnionAsSet would do
collectUnionAsSet: aBlock self inject: Set new into: [ :set :each | set addAll: (aBlock value: each) ]
which is not the same.
cheers, AA
On 17 Jun 2008, at 8:47 , stéphane ducasse wrote:
We will keep it but under flatCollect:
and introduce collectAsSet: for the flatCollect: asSet semantics
Stef
On Jun 17, 2008, at 1:52 AM, Adrian Kuhn wrote:
As I designed it, collectUnion uses the semantics of the receiver for doing the union, ie the union of arrays can have duplicates. Why? I feel this is more natural (and it performs better for millions of objects, never forget, a set is always implemented as dictionary or worse). This test asserts that no one changes collectUnion to use set semantics for arrays.
But feel free to change this if you prefer set semantics.
AA
On 14 Jun 2008, at 15:55 , stéphane ducasse wrote:
I would like to fix collectUnion:
and I would like to understand why
(#((1 2) (3 4) (5 3)) collectUnion: [ :each ]) equalsTo: #(1 2 3 3 4 5))
and not to #(1 2 3 4 5)
is it a bug in the test? Stef