#(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