Apply a callback to an array: Difference between revisions

m
Line 1,656:
Actually, there is a builtin <tt>squared</tt> operator:
<lang SuperCollider>[1, 2, 3].squared; // returns [1, 4, 9]</lang>
[[List Comprehensions#SuperCollider|List comprehension]] combined with a higher-order function can also be used:
<lang SuperCollider>var square = {
arg x;
Anonymous user