#splitByGroupingWhile:
The 'split' indicates it's a method to split a collection, and the
'GroupingWhile' expresses how it's done: by grouping elements while they
make the block evaluate to the same value.
Le 12/12/2017 à 10:50, Sven Van Caekenberghe a écrit :
#splitWhile: because the block does not define separators but its value
indicates runs ?
On 12 Dec 2017, at 10:34, Thomas Dupriez <[email protected]>
wrote:
#(1 2 3 4 1 2 3 5 6 ) splitWhen: [ :each | each = 4]
Le 12/12/2017 à 10:23, Pavel Krivanek a écrit :
Hi,
do you have some proposals for a better name for the message named
#aggregateRuns?
(#(1 2 3 4 1 2 3 5 6 ) aggregateRuns: [ :each | each = 4])
>>> #(#(1 2 3) #(4) #(1 2 3 5 6)).
(#(1 2 3 4 1 2 3 4 5 6 ) aggregateRuns: [ :each | each = 4])
>>> #(#(1 2 3) #(4) #(1 2 3) #(4) #(5 6)).
((1 to: 12) aggregateRuns: [ :each | (each \\ 3) = 0])
>>> #(#(1 2) #(3) #(4 5) #(6) #(7 8) #(9) #(10 11) #(12)).
The current comment is:
"Answer a new collection of the same species as the
receiver with elements being collections (of the receiver
species) containing those elements of the receiver
for which the given block consecutively evaluates to
the same object."
https://pharo.fogbugz.com/f/cases/20864/add-examples-to-SequenceableCollection-aggregateRuns
Cheers,
-- Pavel