Simple Array Rotation?

Hi there -

I have an issue where I need to “rotate” an array, I believe. Let’s say I have 12 items in my array, something like this:

[0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2]
```
But I need four separate arrays that would all look like:
```
[[0, 1, 2], [0, 1, 2], [0,1, 2], [0, 1, 2]]
```
Each section would be groups of four, combined vertically.. 

I'm assuming there is a syntactically-sweet way of doing this in SuperCollider, but I'm not sure I'm looking in the right place..  Does anyone know how to do this?

Thank you!

[0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2].clump(4).flop

This helpfile is useful SequenceableCollection | SuperCollider 3.12.2 Help

1 Like