< Back to IRCAM Forum

Group-list based on a test (loop question)

Hi,
I am trying to make a loop which would group an incoming list into sublists based on a test of ascending order of numbers.

Eg.
incomnig list: (1 2 3 2 5 7 1 3 5)
result: ((1 2 3)(2 5 7)(1 3 5))

Please, can anybody help me here?

PS. I know it is easier to make it in LISP-code, but, if possible, I would like to see an example of how it is programable in OM GUI in order to be able to apply it also for other test-functions.

All the best!

Ališer

Hey Ališer,

there are of course plenty options to accomplish this task. Here is a rather clumsy solution which behaves somewhat differently than OM’s n-group-list, as it just cuts the modulo of the list if the ratio of list-length to group-size is non-integer. In this case, n-group-list fills the empty positions with a nil.

Best regards
Ruben

Hi Aliser,

Ruben’s idea is not bad. This is another version here:


However i recommend using lisp code because it is more straight forward and less awkward.

Here is a folder to be imported in the workspace:
list_group.zip (2.6 KB)

Best
K

1 Like

Brilliant! I guess I must admit, that I missed the actual point by sticking too much to the example list.

1 Like

Dear Karim and Ruben,

Thank you very much for your answers an for the files! I was trying to solve this problem by using acum accumulator, but with no success. So I learned much from your examples. (Somehow I thought it is the easiest way.)
As Karim said, to make some things in GUI is really awkward and much more complex then in code.

Thank you once more and all the best!

Aliser

1 Like