#(1 1 1 2 2 2 3 3 3 4 4 4) . 3 -> #(#(1 1 1) (2 2 2) (3 3 3) #(4 4 4))
Hi guys do you know if we have around a method doing the following? #(1 1 1 2 2 2 3 3 3 4 4 4) . 3 -> #(#(1 1 1) (2 2 2) (3 3 3) #(4 4 4)) it could also be another one #(1 1 1 2 2 2 3 3 3 4 4 4) . 4 -> #(#(1 1 1) (2 2 2) (3 3 3) #(4 4 4)) S -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
I don't understand your intent. Do they group together because they have the same value or do they just get grouped into subgroups of size three or do they get grouped as runs? This works: #(1 1 1 2 2 2 3 3 3 4 4 4) groupByRuns: [ :ea | ea ] -> #(#(1 1 1) (2 2 2) (3 3 3) #(4 4 4))
On Jun 3, 2020, at 1:53 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Hi guys
do you know if we have around a method doing the following?
#(1 1 1 2 2 2 3 3 3 4 4 4) . 3 -> #(#(1 1 1) (2 2 2) (3 3 3) #(4 4 4))
it could also be another one
#(1 1 1 2 2 2 3 3 3 4 4 4) . 4 -> #(#(1 1 1) (2 2 2) (3 3 3) #(4 4 4))
S
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
Hi Stef,  from the (incomplete) sample it is unclear what is really needed:   1. Both return the same result: #(#(1 1 1) (2 2 2) (3 3 3) #(4 4 4)) which is syntactically equal to #(#(1 1 1) #(2 2 2) #(3 3 3) #(4 4 4))   So why did you leave out the # for the contained sub-array with 2's and 3's?  2. When the result is equal in both examples why give a different argument like 3 and 4?  3. What about edge case inputs like:  #(1 1 1 2 2 2 4 4 4)     not having sucessors/predecessor order                     #(2 2 2 1 1 1 3 3 3 4 4 4) with different order (not ascending)                     #(1 1 1 1 2 2 2 3 3 3 4 4 4) where 1 is included more often than the other   4. ... Nonetheless: the closest that might possibly be of use is #groupByRuns: message   #(1 1 1 2 2 2 3 3 3 4 4 4) groupByRuns: [:e | e ]  ->  #(#(1 1 1) #(2 2 2) #(3 3 3) #(4 4 4)) Have fun T.   Gesendet: Mittwoch, 03. Juni 2020 um 22:53 Uhr Von: "Stéphane Ducasse" <stephane.ducasse@inria.fr> An: "Pharo Development List" <pharo-dev@lists.pharo.org> Betreff: [Pharo-dev] #(1 1 1 2 2 2 3 3 3 4 4 4) . 3 -> #(#(1 1 1) (2 2 2) (3 3 3) #(4 4 4)) Hi guys  do you know if we have around a method doing the following?  #(1 1 1 2 2 2 3 3 3 4 4 4) . 3 -> #(#(1 1 1) (2 2 2) (3 3 3) #(4 4 4))  it could also be another one  #(1 1 1 2 2 2 3 3 3 4 4 4) . 4 -> #(#(1 1 1) (2 2 2) (3 3 3) #(4 4 4))  S  -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org[http://www.pharo.org] 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
participants (3)
-
Stéphane Ducasse -
Todd Blanchard -
Torsten Bergmann