This file is indexed.

/usr/share/SuperCollider/HelpSource/Reference/Literals.schelp is in supercollider-common 1:3.8.0~repack-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
title:: Literals
summary:: values with a direct syntactic representation
related:: Classes/Number, Classes/Integer, Classes/Float, Classes/SimpleNumber, Classes/String, Classes/Array, Classes/Symbol
categories:: Language

Literals are values which have a direct syntactic representation.
The following sections describe the types of literals that can be represented.

section::Numbers

subsection::Integers
An integer is any series of digits optionally preceded by a minus sign:
code::
-13
666
2112
96
::

subsection::Floats
A float is one or more decimal digits followed by a decimal point followed by one or more decimal digits.
You must have digits on both sides of the decimal point.  This distinguishes floating point numbers from
integer expressions like code::8.rand::.

Examples of floats:
code::
0.39
98.6
1.0
-0.5
::

Exponential notation is also supported:
code::
1.2e4
1e-4
::

The constant pi can be appended to a number to create a floating point constant:
code::
pi
2pi
0.5pi
-0.25pi
::

subsection::Radix
Numbers can also be written in radices other than base 10 up to base 36.
The radix is specified in base 10 followed by the letter 'r' followed by the value written in
that radix using characters 0-9,A-Z, or a-z, for digit values from 0 to 35.
For example you can write hexadecimal numbers as follows:
code::
16rF0
16rA9FF
::
Binary numbers can be written as follows:
code::
2r01101011
::

Floating point values may also be specified in any base:
code::
12r4A.A
::

subsection::Scale Degrees
Integer numbers as scale degrees supports accidentals notation by adding the suffixes strong::s:: for sharp and strong::b:: for flat. Accidentals are represented as floating point values.

code::
2s == 2.1  // scale degree two, sharp
2b == 1.9  // scale degree two, flat
2ss == 2.2 // scale degree two, double sharp
2bb == 1.8 // scale degree two, double flat
::

Up to four:

code::
2ssss == 2.4
2bbbb == 1.6
::

With negative scale degrees it reverses:

code::
-2s == -1.9
-2b == -2.1
-2ss == -1.8
-2bb == -2.2
::

Accidentals can also specify cents deviation up to 499 cents:

code::
2b50 == 1.95 // scale degree two, fifty cents flat
2s204 == 2.204 // scale degree two, 204 cents sharp
::


section::Characters

Characters are preceded by a dollar sign:
code::
$A
$B
$C
::

Tab, linefeed, carriage return, and backslash are preceded by a backslash. See link::#Escape character:: below.
code::
$\t
$\n
$\r
$\\
::

section::Symbols and Strings

subsection::Symbols
A symbol is written as a string enclosed in single quotes.
examples of symbols:
code::
'x'
'aiff'
'BigSwiftyAndAssoc'
'nowhere here'
'somewhere there'
'.+o*o+.'
::

A symbol consisting of a single word can be written with a preceding backslash.
code::
\x
\aiff
\BigSwiftyAndAssoc
::

subsection::Strings

Strings are written in double quotes:
code::
"This is a string."
::

If two or more strings are lexically adjacent, then they combine into a larger string:
code::
"This" " is " "also a " "string."
::

Strings may span more than one line. If so, then the new line characters become part of the string:
code::
"This
is
also a
string.
"
::

subsection::Escape character

As in C and Java, a backslash, \, is the emphasis::escape character::. Escaping has two main purposes:

list::
## To insert non-printing characters into a string: teletype::\n:: for newline, teletype::\t:: for tab, teletype::\l:: for linefeed, teletype::\r:: for carriage return. (This usage is valid only for Strings, not Symbols.)
## To allow a string or symbol delimiter to be included in the contents. That is, for strings, normally double-quote marks indicate the beginning and ending of the string literal. To put a double-quote in the middle of the string, the normal meaning of double-quote should be suspended -- "escaped" -- as in code::"He repeated, \"Madam, I'm Adam,\" only this time he had said it backward."::
::

In all cases, the \ as an escape character does not appear in the string or symbol. This is a frequent source of confusion for Windows file paths, e.g., code::"C:\Users\Somebody\SuperCollider":: translates into teletype::C:UsersSomebodySuperCollider::. Backslashes that should appear need to be escaped themselves: code::"C:\\Users\\Somebody\\SuperCollider"::. (Note, however, that it is preferable to write file paths using forward slashes, regardless of platform, as in Java: code::"C:/Users/Somebody/SuperCollider"::.)

section::Identifiers

Names of methods and variables begin with a lower case alphabetic character, followed by zero or more
alphanumeric characters. An underscore is also valid in an identifier.
code::
var abc, z123, trigger_func;
::

section::Class Names

Class names always begin with a capital letter followed by zero or more alphanumeric characters.
code::
Object
Point
Synth
SinOsc
Pan2
::

section::Special Values

The singular instances of the classes True, False and Nil are written as the
words true, false, nil and inf.
code::
x = true;
y = false;
z = nil;
::

section::Arrays

link::Classes/Array::s of literals are created at compile time and are written with a # preceding the array as follows:
code::
#[1, 2, 'abc', "def", 4]
::
Literal Arrays must be used as is and may not be altered at run time.

In literal Arrays names are interpreted as symbols. This is not the case in regular Arrays, where they are interpreted as variable names:
code::
#[foo, bar]     // this is legal; an Array of Symbols
[foo, bar]      // this is only legal if foo and bar have been declared as variables
::
Arrays and other collections may also be created dynamically which is explained in link::Classes/Collection::.
Using a literal Array is faster than building an array dynamically every time you need it.

When nesting literal arrays, only the outermost literal array needs the '#' character.
code::
#[[1, 2, 3], [4, 5, 6]]
::

Literal Arrays can be useful for things such as tables of constants, for example note names:
code::
(
// build a table of note names
var table = ();
value {
    var semitones = [0, 2, 4, 5, 7, 9, 11];
    var naturalNoteNames = ["c", "d", "e", "f", "g", "a", "b"];

    (0..9).do {|o|
        naturalNoteNames.do {|c, i|
            var n = (o + 1) * 12 + semitones[i];
            table[(c ++ o).asSymbol] = n;
            table[(c ++ "s"  ++ o).asSymbol] = n + 1;
            table[(c ++ "ss" ++ o).asSymbol] = n + 2;
            table[(c ++ "b"  ++ o).asSymbol] = n - 1;
            table[(c ++ "bb" ++ o).asSymbol] = n - 2;
        };
    };
};

// translate note names to midi keys
table.atAll(#[c4, e4, gs4, c5, e5, gs5, c6])
)
::

section:: Compiler limits

There is no theoretical limit on the number of literals in a single function, if those literals are used as freestanding objects. (Of course, there remains the practical limits of system memory and the processor time required to keep track of all the objects.)

The following are a special category of literal, called emphasis::selectors::.

list::
## Class names
## Method names
## Function definitions (enclosed in curly braces code::{  }::)
::

Here, there are four selectors: code::SinOsc::, code::ar::, code::play:: and the entire function containing SinOsc.

code::{ SinOsc.ar(440, 0, 0.1) }.play;::

A single function may contain no more than 256 selectors. If this limit is exceeded, a compiler error is printed:

teletype::ERROR: Selector table too big: too many classes, method selectors or function definitions in this function. Simplify the function.::

note::
Code submitted for interactive execution is first compiled into a function. A very large block of code, spanning several thousand lines, may run into this limitation if it doesn't break down the tasks into smaller functions. In general, code is easier to maintain if it is reasonably emphasis::modular::, with small functions handling clearly-defined parts of the problem. This error message is a signal that the code has become too complex for a loose or "flat" code structure.
::

subsection:: What counts as "inside the function"?

Selectors are counted only toward the function definition currently being compiled.

code::
{ x.foo };

{ x.bar };
::

Both functions contain exactly one selector. They are separate functions. The use of "foo" in one function doesn't affect the number of selectors in another function.

code::
{
	var f = { |n|
		if(n > 1) { n * f.value(n-1) } { 1 }
	};

	f.value(10);
}.value;
::

The outer function includes only the selector code::value::. The other selectors -- code::>::, code::*::, code::-:: -- belong to the inner function definition and don't affect the outer function's number of selectors.

So, one possible easy way to work around the limitation is to break up a large block of code into several functions that are value'd successively:

code::
{
	... a bunch of code ...
}.value;

{
	... a bunch of code ...
}.value;

{
	... a bunch of code ...
}.value;
::