Search code examples
arraysmultidimensional-arraysupercollider

SuperCollider: What's the command to make [ [1,2], [3,4] ] become [1,2,3,4]?


What's the command to make [ [1,2], [3,4] ] become [1,2,3,4] ?

(asked on behalf of someone else)


Solution

  • The .flat message is what you're after:

    [[1,2],[3,4]].flat

    there's also .flatten which gives the same result in this case (but .flatten only flattens one "level" whereas .flat will flatten all the way down to a fully-flat array)