View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

Array manipulations

Home   How To   Code Pool   Public Library   Theory   Events
Various and sundry array manipulation tricks... please add more if you have some!

Back to Code Pool (sc3)


If I have a matrix as follows:

a = [[0, 1, 2], [3, 4, 5], [6, 7, 8]];

a.do({ |row| row.postln });
[0, 1, 2]
[3, 4, 5]
[6, 7, 8]


And I want:

[0, nil, 2]
[3, nil, 5]
[6, nil, 8]


I can do this to get it:

a = a.flop.put(1, nil).flop;




For info about multi-dimension Arrays, see the J_concepts_in_SC.rtf help file in the distribution.


Please add more!

Link to this Page