< Back to IRCAM Forum

List segmentation and iteration

Hello,
I’m new in OM,

I’m tring to figure out how to obtain lists from list regoular segmentations, that is, for example, from:
(1 2 3 4 5 6 7)

I want to get 3-elements lists, wich have as first element each element of the original list:
(1 2 3) (2 3 4) (3 4 5) etc.

I’d also like to define steps between elements of the new lists, for example take an element every 2:
(1 3 5) (2 4 6) (3 5 7) etc.

I know i should use omloop or some combination of iteration and circulation, but as I said before I’m new in OM and I’m still going through the tutorials!

Thank you very much,

Lorenzo

Hi Lorenzo

All included in the patch. your last probleme can be done more elegantly but in lisp code.
However it works.

BEst
K

list-grouping.omp (8.64 KB)

Perfect! The objects in the omloop are the same I was tring to use, without success…
Thank you very much.

Best regards,

Lorenzo