[squeak-dev] The Inbox: Collections-ct.827.mcz
Tobias Pape
Das.Linux at gmx.de
Sat Jun 1 15:05:55 UTC 2019
> On 01.06.2019, at 16:51, K K Subbu <kksubbu.ml at gmail.com> wrote:
>
> On 31/05/19 6:04 PM, Christoph Thiede wrote:
>> #(1 2 3) asSet joinSeparatedBy: '-
> What is the expected answer for joining set members by '-'?
>
> If I have a set with members #daa, #dee, #dum, the output could be any of 'daa-dee-dum', 'daa-dum-dee', 'dum-dee-daa', ....
>
> Squeak 5.2alpha shows the order as 'dee-daa-dum'
I think that's why #joinSeparatedBy: was initially only on sequenceable collection.
I mean, it is also unclear what joinSeparatedBy: would mean on a Bag with multiple occurrences, or a Matrix, or a Bitset…
On the other hand, you can always do things like
myCollection asArray joinSeparatedBy: 'fnord'
or
myBag cumulativeCounts joinSeparatedBy: ', '
or
(mySet sorted: [:a :b | a >= b]) joinSeparatedBy: ' is more than '
and be explicit on what you expect to establish the sequence.
Best regards
-Tobias
More information about the Squeak-dev
mailing list
|