On 12 December 2017 at 17:23, Pavel Krivanek <pavel.krivanek@gmail.com> wrote:
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
Split is almost an obvious choice, except I feel the same as Norbert that "split methods operate on separators which are not included in the result." Maybe "groupSomethingXXX"... But after pondering a while for a better name, I wonder what is wrong with the existing? Googling "define aggregate" provides... aggregate (noun) = a whole formed by combining several separate elements. aggregate (verb) = form or group into a class or cluster. The separate elements are runs defined by the block. The existing name seems quite precise to me. cheers -ben