better name for #aggregateRuns:
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-SequenceableCollecti... Cheers, -- Pavel
Hi Pavel, On 12 December 2017 at 10: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-SequenceableCollecti...
Cheers, -- Pavel
#groupAround: #selectAround: Cheers, Alistair
Hi #(1 2 3 4 1 2 3 5 6 ) collectGroupsWhere: [ :each | each = 4]) 2017-12-12 10:23 GMT+01:00 Pavel Krivanek <pavel.krivanek@gmail.com>:
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
#(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-SequenceableCollecti...
Cheers, -- Pavel
We already have #splitOn: with slightly different behavior: (#(1 2 3 4 1 2 3 5 6 ) splitOn: [ :each | each = 4]) So splitOnEach: and splitWhen: would be probably confusing 2017-12-12 10:34 GMT+01:00 Thomas Dupriez < thomas.dupriez@ens-paris-saclay.fr>:
#(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-Sequ enceableCollection-aggregateRuns
Cheers, -- Pavel
maybe something in the direction of splitOnThresholds:? 2017-12-12 10:38 GMT+01:00 Pavel Krivanek <pavel.krivanek@gmail.com>:
We already have #splitOn: with slightly different behavior:
(#(1 2 3 4 1 2 3 5 6 ) splitOn: [ :each | each = 4])
So splitOnEach: and splitWhen: would be probably confusing
2017-12-12 10:34 GMT+01:00 Thomas Dupriez <thomas.dupriez@ens-paris- saclay.fr>:
#(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-Sequ enceableCollection-aggregateRuns
Cheers, -- Pavel
#splitWhile: because the block does not define separators but its value indicates runs ?
On 12 Dec 2017, at 10:34, Thomas Dupriez <thomas.dupriez@ens-paris-saclay.fr> 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-SequenceableCollecti...
Cheers, -- Pavel
#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 <thomas.dupriez@ens-paris-saclay.fr> 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-SequenceableCollecti...
Cheers, -- Pavel
For me split methods operate on separators which are not included in the result. So name it splitXXX might not be the best idea. And I think it should be more explicit. When the matching elements are included in the result it needs to indicate where the are added. So it is rather something like xxxAfter: because the collection is separated after the matching element. What the method does is oppositional to flattenXXX. So if we would have the opposite term of flatten that might be a good candidate. Then it would be something like roughenAfter: :) Ok, stupid name but you got the idea. Norbert
Am 12.12.2017 um 10:50 schrieb Sven Van Caekenberghe <sven@stfx.eu>:
#splitWhile: because the block does not define separators but its value indicates runs ?
On 12 Dec 2017, at 10:34, Thomas Dupriez <thomas.dupriez@ens-paris-saclay.fr> 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-SequenceableCollecti...
Cheers, -- Pavel
Hm, aggregateRuns: separates the collection both after and before the separator. #(1 2 3 4 1 2 4 5 6 ) aggregateRuns: [ :each | each = 4] ->   #(#(1 2 3) #(4) #(1 2) #(4) #(5 6)) Le 12/12/2017 à 11:05, Norbert Hartl a écrit :
For me split methods operate on separators which are not included in the result. So name it splitXXX might not be the best idea. And I think it should be more explicit. When the matching elements are included in the result it needs to indicate where the are added. So it is rather something like
xxxAfter:
because the collection is separated after the matching element. What the method does is oppositional to flattenXXX. So if we would have the opposite term of flatten that might be a good candidate. Then it would be something like
roughenAfter:
:) Ok, stupid name but you got the idea.
Norbert
Am 12.12.2017 um 10:50 schrieb Sven Van Caekenberghe <sven@stfx.eu>:
#splitWhile: because the block does not define separators but its value indicates runs ?
On 12 Dec 2017, at 10:34, Thomas Dupriez <thomas.dupriez@ens-paris-saclay.fr> 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-SequenceableCollecti...
Cheers, -- Pavel
Oups, spoke too fast. My bad. I mean that I don't really see a 'matching element' here, it's more that the collection is cut whenever the block given as argument evaluates to a different value. Le 12/12/2017 à 11:11, Thomas Dupriez a écrit :
Hm, aggregateRuns: separates the collection both after and before the separator.
#(1 2 3 4 1 2 4 5 6 ) aggregateRuns:Â [ :each | each = 4]
-> Â Â #(#(1 2 3) #(4) #(1 2) #(4) #(5 6))
Le 12/12/2017 à 11:05, Norbert Hartl a écrit :
For me split methods operate on separators which are not included in the result. So name it splitXXX might not be the best idea. And I think it should be more explicit. When the matching elements are included in the result it needs to indicate where the are added. So it is rather something like
xxxAfter:
because the collection is separated after the matching element. What the method does is oppositional to flattenXXX. So if we would have the opposite term of flatten that might be a good candidate. Then it would be something like
roughenAfter:
:) Ok, stupid name but you got the idea.
Norbert
Am 12.12.2017 um 10:50 schrieb Sven Van Caekenberghe <sven@stfx.eu>:
#splitWhile: because the block does not define separators but its value indicates runs ?
On 12 Dec 2017, at 10:34, Thomas Dupriez <thomas.dupriez@ens-paris-saclay.fr> 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-SequenceableCollecti...
Cheers, -- Pavel
Sorry, Iâm not sure what Iâve read but it does not seem to be the mail of Pavel :) Norbert
Am 12.12.2017 um 11:05 schrieb Norbert Hartl <norbert@hartl.name>:
For me split methods operate on separators which are not included in the result. So name it splitXXX might not be the best idea. And I think it should be more explicit. When the matching elements are included in the result it needs to indicate where the are added. So it is rather something like
xxxAfter:
because the collection is separated after the matching element. What the method does is oppositional to flattenXXX. So if we would have the opposite term of flatten that might be a good candidate. Then it would be something like
roughenAfter:
:) Ok, stupid name but you got the idea.
Norbert
Am 12.12.2017 um 10:50 schrieb Sven Van Caekenberghe <sven@stfx.eu>:
#splitWhile: because the block does not define separators but its value indicates runs ?
On 12 Dec 2017, at 10:34, Thomas Dupriez <thomas.dupriez@ens-paris-saclay.fr> 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-SequenceableCollecti...
Cheers, -- Pavel
If short names not work, what about to use something more descriptive like #splitToGroupsThatAlternatelySafisfy: -- Pavel 2017-12-12 10:23 GMT+01:00 Pavel Krivanek <pavel.krivanek@gmail.com>:
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
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
Ben Coman wrote
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
When I read aggregateRuns:, I think the opposite; something combining different runs into a single entity, not something that splits a single collection into constituent runs... Something like (split/collect)runsAccordingTo: sounds more descriptive to my ears, at least. Cheers, Henry -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
2017-12-12 13:01 GMT+01:00 Henrik Sperre Johansen < henrik.s.johansen@veloxit.no>:
Ben Coman wrote
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
When I read aggregateRuns:, I think the opposite; something combining different runs into a single entity, not something that splits a single collection into constituent runs...
Something like (split/collect)runsAccordingTo: sounds more descriptive to my ears, at least.
Cheers, Henry
I like groupBy: but in Squeak groupBy: produces a dictionary with unique keys ignoring the multiple sequences... split already carries the meaning of preserving the sequences, but we have to tell to split at a change of value.... Run is also quite explicit... groupByRuns: / splitRuns:
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
On 12 December 2017 at 20:03, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote:
2017-12-12 13:01 GMT+01:00 Henrik Sperre Johansen < henrik.s.johansen@veloxit.no>:
Ben Coman wrote
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
When I read aggregateRuns:, I think the opposite; something combining different runs into a single entity, not something that splits a single collection into constituent runs...
okay. I can understand that perspective.
Something like (split/collect)runsAccordingTo: sounds more descriptive to my ears, at least.
Cheers, Henry
I like groupBy: but in Squeak groupBy: produces a dictionary with unique keys ignoring the multiple sequences... split already carries the meaning of preserving the sequences, but we have to tell to split at a change of value.... Run is also quite explicit...
groupByRuns: / splitRuns:
+1 groupByRuns: is good. cheers -ben
I'm kind of trying to figure out when I'd want that operation. groupsWithSeparatorsWhereSeparatatorsMatch: feels like it says what it does
On Dec 12, 2017, at 10:19 AM, Ben Coman <btc@openinworld.com> wrote:
On 12 December 2017 at 20:03, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com <mailto:nicolas.cellier.aka.nice@gmail.com>> wrote:
2017-12-12 13:01 GMT+01:00 Henrik Sperre Johansen <henrik.s.johansen@veloxit.no <mailto:henrik.s.johansen@veloxit.no>>: Ben Coman wrote
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
When I read aggregateRuns:, I think the opposite; something combining different runs into a single entity, not something that splits a single collection into constituent runs...
okay. I can understand that perspective.
Something like (split/collect)runsAccordingTo: sounds more descriptive to my ears, at least.
Cheers, Henry
I like groupBy: but in Squeak groupBy: produces a dictionary with unique keys ignoring the multiple sequences... split already carries the meaning of preserving the sequences, but we have to tell to split at a change of value.... Run is also quite explicit...
groupByRuns: / splitRuns:
+1 groupByRuns: is good.
cheers -ben
groupByRuns: looks good to me. On Tue, Dec 12, 2017 at 9:48 PM, Todd Blanchard <tblanchard@mac.com> wrote:
I'm kind of trying to figure out when I'd want that operation.
groupsWithSeparatorsWhereSeparatatorsMatch: feels like it says what it does
On Dec 12, 2017, at 10:19 AM, Ben Coman <btc@openinworld.com> wrote:
On 12 December 2017 at 20:03, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> wrote:
2017-12-12 13:01 GMT+01:00 Henrik Sperre Johansen <henrik.s.johansen@veloxit.no>:
Ben Coman wrote
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
When I read aggregateRuns:, I think the opposite; something combining different runs into a single entity, not something that splits a single collection into constituent runs...
okay. I can understand that perspective.
Something like (split/collect)runsAccordingTo: sounds more descriptive to my ears, at least.
Cheers, Henry
I like groupBy: but in Squeak groupBy: produces a dictionary with unique keys ignoring the multiple sequences... split already carries the meaning of preserving the sequences, but we have to tell to split at a change of value.... Run is also quite explicit...
groupByRuns: / splitRuns:
+1 groupByRuns: is good.
cheers -ben
On Tue, Dec 12, 2017 at 10:23 AM, 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-SequenceableCollecti...
Cheers, -- Pavel
divideOn:? -- Cyril Ferlicot https://ferlicot.fr http://www.synectique.eu 2 rue Jacques Prévert 01, 59650 Villeneuve d'ascq France
participants (12)
-
Alistair Grant -
Ben Coman -
Cyril Ferlicot -
Denis Kudriashov -
Henrik Sperre Johansen -
Nicolas Cellier -
Norbert Hartl -
Pavel Krivanek -
Stephane Ducasse -
Sven Van Caekenberghe -
Thomas Dupriez -
Todd Blanchard