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" <
[hidden email]>
An: "Pharo Development List" <
[hidden email]>
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