What's the role of “*”, “#”, “_”?

I’ve been reading through a lot of tutorials and forums on SuperCollider lately, and came across on some code samples using * and # and _, but I don’t find why they are used. Can someone explain that to me ? // Is there somewhere a comprehensive list of all this characters and their usage ?

Some samples:

* as in:

var list = [1, 2, 3];
func(*list);  // equivalent to func(list[0], list[1], list[2])

or # for literal array :
But then, why using literal arrays instead of regular arrays ?

p = Pbind(
    \degree, Pwhite(-7, 12, inf),
    \dur, Pwrand([0.25, Pn(0.125, 2)], #[0.8, 0.2], inf),
    \legato, Pfunc { ~legato }    // retrieves value set by MIDI control

or #: this is not a literal array, is it ?:

var a, b, c;
#a, b, c = [1, 2, 3]; // equivalent to a=1; b=2; c=3;

or _ as in:

    \mtranspose, -1,
    \octave, 5,
    [\dur, \degree], Ptuple(y.collect(Pseq(_, inf)))

Individual characters in SC have a variety of meanings depending on the context, but the specific use of _ for partial function application and * as a shortcut for performList are explained here: https://doc.sccode.org/Reference/Syntax-Shortcuts.html

The use of # for literal arrays is detailed here: https://doc.sccode.org/Reference/Literals.html#Arrays

1 Like

No, it isn’t. It’s a “multiple assignment” statement:




Thanks. I’ll read all this.