hello, two bugs: Collection>#union: and Collection>#collectUnion: the first pb is where the receiver is a set, and the second one is that (#(1 2 3) union: #(1 2 3 4))-->#(1 2 3 4), but (#(#(1 2) #(2 3) #(3 4)) collectUnion: [:each])-->#(1 2 2 3 3 4). I have added some new asserts inside CollectionTest>>#testCollectUnion (actually there is two red tests in this class) and published a new version of CodeFooDevelopment.
best wishes, hani
Hi Hani,
Actually, the collectUnion: used to be named flatCollect: and that described better what it did, because collectUnion: is not intended to return a set union.
For example, one usage is to combine it with groupedBy: allNumbers := #(#(1 2) #(2 3) #(3 4)) collectUnion: #yourself. oddElements := allNumbers groupedBy: #odd. --> Dictionary (true->#(1 3 3) false->#(2 2 4) )
You can use this to count afterwards the number of occurrences of a certain pattern.
But, I agree that the name is ambiguous.
Cheers, Doru
On Mar 4, 2008, at 4:56 PM, Hani ABDEEN wrote:
hello, two bugs: Collection>#union: and Collection>#collectUnion: the first pb is where the receiver is a set, and the second one is that (#(1 2 3) union: #(1 2 3 4))-->#(1 2 3 4), but (#(#(1 2) #(2 3) #(3 4)) collectUnion: [:each])-->#(1 2 2 3 3 4). I have added some new asserts inside CollectionTest>>#testCollectUnion (actually there is two red tests in this class) and published a new version of CodeFooDevelopment.
best wishes, hani _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com www.tudorgirba.com/blog
"What we can governs what we wish."