This file is indexed.

/usr/share/SuperCollider/HelpSource/Classes/ArrayedCollection.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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
CLASS::ArrayedCollection
categories::Collections>Ordered
summary:: Abstract superclass of Collections of fixed maximum size

DESCRIPTION::
ArrayedCollection is an abstract class, a subclass of SequenceableCollections whose elements are held in a vector of slots. Instances of ArrayedCollection have a fixed maximum size beyond which they may not grow.

Its principal subclasses are link::Classes/Array:: (for holding objects), and link::Classes/RawArray::, from which link::Classes/Int8Array::, link::Classes/FloatArray::, link::Classes/Signal:: etc. inherit.

CLASSMETHODS::

method::newClear
Creates a new instance with strong::indexedSize:: indexable slots. The slots are filled with link::Classes/Nil::, zero or something else appropriate to the type of indexable slots in the object.
code::
Array.newClear(4).postln;
::

method::with
Create a new ArrayedCollection whose slots are filled with the given arguments.
code::
Array.with(7, 'eight',  9).postln;
::

method::series
Fill an ArrayedCollection with an arithmetic series.
code::
Array.series(5, 10, 2).postln;
::

method::geom
Fill an ArrayedCollection with a geometric series.
code::
Array.geom(5, 1, 3).postln;
::

method::iota
Fills an ArrayedCollection with a counter. See link::Guides/J-concepts-in-SC:: for more examples.
code::
Array.iota(2, 3);
Array.iota(2, 3, 4);
::


INSTANCEMETHODS::

method::size
Return the number of elements the ArrayedCollection.

method::maxSize
Return the maximum number of elements the ArrayedCollection can hold. For example, link::Classes/Array::s may initialise themselves with a larger capacity than the number of elements added.
code::
[4, 5, 6].maxSize; // gosh
::

method::at
Return the item at strong::index::.

The index can also be an Array of indices to extract specified elements. Example:
code::
x = [10,20,30];
y = [0,0,2,2,1];
x[y]; // returns [ 10, 10, 30, 30, 20 ]
::

method::clipAt
Same as link::#-at::, but values for strong::index:: greater than the size of the ArrayedCollection will be clipped to the last index.
code::
y = [ 1, 2, 3 ];
y.clipAt(13).postln;
::

method::wrapAt
Same as link::#-at::, but values for strong::index:: greater than the size of the ArrayedCollection will be wrapped around to 0.
code::
y = [ 1, 2, 3 ];
y.wrapAt(3).postln; // this returns the value at index 0
y.wrapAt(4).postln; // this returns the value at index 1
y.wrapAt([-2, 1])   // index can also be a collection or negative numbers
::

method::foldAt
Same as link::#-at::, but values for strong::index:: greater than the size of the ArrayedCollection will be folded back.
code::
y = [ 1, 2, 3 ];
y.foldAt(3).postln; // this returns the value at index 1
y.foldAt(4).postln; // this returns the value at index 0
y.foldAt(5).postln; // this returns the value at index 1
::

method::plot
Plot data in a GUI window. See link::Reference/plot:: for more details.

method::swap
Swap the values at indices i and j.
code::
[ 1, 2, 3 ].swap(0, 2).postln;
::

method::put
Put strong::item:: at strong::index::, replacing what is there.

method::clipPut
Same as link::#-put::, but values for strong::index:: greater than the size of the ArrayedCollection will be clipped to the last index.

method::wrapPut
Same as link::#-put::, but values for strong::index:: greater than the size of the ArrayedCollection will be wrapped around to 0.

method::foldPut
Same as link::#-put::, but values for strong::index:: greater than the size of the ArrayedCollection will be folded back.

method::putEach
Put the strong::values:: in the corresponding indices given by strong::keys::. If one of the two argument arrays is longer then it will wrap.
code::
y = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
y.putEach([4, 7], [\smelly, \head]);
y.putEach([2, 3, 5, 6], \wotsits);
::

method::indexOf
Return the first index containing an item which matches strong::item::.
code::
y = [ \the, \symbol, \collection, \contains, \my, \symbol ];
y.indexOf(\symbol);
::

method::includes
Return a boolean indicating whether the collection contains anything matching strong::item::.
code::
y = [ \the, \symbol, \collection, \contains, \my, \symbol ];
y.includes(\symbol);
y.includes(\solipsism);
::

method::indexOfGreaterThan
Return the first index containing an item which is greater than strong::item::.
code::
y = [ 10, 5, 77, 55, 12, 123];
y.indexOfGreaterThan(70);
::

method::removeAt
Remove and return the element at strong::index::, shrinking the size of the ArrayedCollection.
code::
y = [ 1, 2, 3 ];
y.removeAt(1);
y.postln;
::

method::takeAt
Similar to link::#-removeAt::, but does not maintain the order of the items following the one that was removed. Instead, the last item is placed into the position of the removed item and the array's size decreases by one.
code::
y = [ 1, 2, 3, 4, 5 ];
y.takeAt(1);
y.postln;
::

method::takeThese
Removes all items in the receiver for which the strong::func:: answers true. The function is passed two arguments, the item and an integer index. Note that order is not preserved. See link::#-takeAt::.
code::
y = [ 1, 2, 3, 4 ];
y.takeThese({ arg item, index; item.odd; });	//remove odd items
y.postln;
::

method::add
Adds an item to an ArrayedCollection if there is space. This method may return a new ArrayedCollection. For this reason, you should always assign the result of add to a variable - never depend on code::add:: changing the receiver.
code::
(
// z and y are the same object
var y, z;
z = [1, 2, 3];
y = z.add(4);
z.postln;
y.postln;
)

(
// in this case a new object is returned
var y, z;
z = [1, 2, 3, 4];
y = z.add(5);
z.postln;
y.postln;
)
::

method::addAll
Adds all the elements of aCollection to the contents of the receiver. This method may return a new ArrayedCollection. For this reason, you should always assign the result of code::addAll:: to a variable - never depend on add changing the receiver.
code::
(
// in this case a new object is returned
var y, z;
z = [1, 2, 3, 4];
y = z.addAll([7, 8, 9]);
z.postln;
y.postln;
)
::

method::extend
Extends the object to match strong::size:: by adding a number of strong::item::s. If strong::size:: is less than receiver size then truncate. This method may return a new ArrayedCollection. For this reason, you should always assign the result of code::extend:: to a variable - never depend on add changing the receiver.
code::
(
var y, z;
z = [1, 2, 3, 4];
y = z.extend(10, 9);		//fill up with 9 until the size equals 10
z.postln;
y.postln;
)
::

method::fill
Inserts the item into the contents of the receiver. note::the difference between this and link::Classes/Collection#fill#Collection's *fill::.::
code::
(
var z;
z = [1, 2, 3, 4];
z.fill(4).postln;
z.fill([1,2,3,4]).postln;
)
::

method::insert
Inserts the item into the contents of the receiver. This method may return a new ArrayedCollection. For this reason, you should always assign the result of code::insert:: to a variable - never depend on add changing the receiver.
code::
(
// in this case a new object is returned
var y, z;
z = [1, 2, 3, 4];
y = z.insert(1, 999);
z.postln;
y.postln;
)
::

method::move
Moves an item from one position to another.

code::
[10, 20, 1000, 40, 50].move(2, 0) // move 1000 to index 0
::

argument::fromIndex
The position in the array from which the element is removed.
argument::toIndex
The position in the array before which the element is inserted again.




method::addFirst
Inserts the item before the contents of the receiver, possibly returning a new collection.
code::
(
// in this case a new object is returned
var y, z;
z = [1, 2, 3, 4];
y = z.addFirst(999);
z.postln;
y.postln;
)
::

method::pop
Remove and return the last element of the ArrayedCollection.
code::
(
var z;
z = [1, 2, 3, 4];
z.pop.postln;
z.postln;
)
::

method::grow
Increase the size of the ArrayedCollection by strong::sizeIncrease:: number of slots, possibly returning a new collection.

method::growClear
Increase the size of the ArrayedCollection by strong::sizeIncrease:: number of slots, returning a new collection with link::Classes/Nil::s in the added slots.
code::
// Compare:
[4,5,6].grow(5);
[4,5,6].growClear(5);
::

method::copyRange
Return a new ArrayedCollection which is a copy of the indexed slots of the receiver from strong::start:: to strong::end::. If strong::end:: < strong::start::, an empty ArrayedCollection is returned.
code::
(
var y, z;
z = [1, 2, 3, 4, 5];
y = z.copyRange(1,3);
z.postln;
y.postln;
)
::
warning:: code::x.copyRange(a, b):: is strong::not:: equivalent to code::x[a..b]::. The latter compiles to link::#-copySeries::, which has different behavior when strong::end:: < strong::start::. ::

method::copySeries
Return a new ArrayedCollection consisting of the values starting at strong::first::, then every step of the distance between strong::first:: and strong::second::, up until strong::last::. If strong::second:: is code::nil::, a step of 1 or -1 is used as appropriate.

code::x.copySeries(a, nil, c):: is equivalent to code::x[a..c]::, and code::x.copySeries(a, b, c):: is equivalent to code::x[a,b..c]::

code::
(
var y, z;
z = [1, 2, 3, 4, 5, 6];
y = z.copySeries(0, 2, 5);
y.postln;
)
::

method::seriesFill
Fill the receiver with an arithmetic progression. The first element will be strong::start::, the second strong::start + step::, the third strong::start + step + step:: ...
code::
(
var y;
y = Array.newClear(15);
y.seriesFill(5, 3);
y.postln;
)
::

method::putSeries
Put strong::value:: at every index starting at strong::first::, then every step of the distance between strong::first:: and strong::second::, up until strong::last::.
code::x.putSeries(a, b, c, val):: can also be written as code::x[a, b..c] = val::
code::
(
var y, z;
z = [1, 2, 3, 4, 5, 6];
y = z.putSeries(0, 2, 5, "foo");
y.postln;
)
::

method::++
Concatenate the contents of the two collections into a new ArrayedCollection.
code::
(
var y, z;
z = [1, 2, 3, 4];
y = z ++ [7, 8, 9];
z.postln;
y.postln;
)
::

method::reverse
Return a new ArrayedCollection whose elements are reversed.
code::
(
var y, z;
z = [1, 2, 3, 4];
y = z.reverse;
z.postln;
y.postln;
)
::

method::do
Iterate over the elements in order, calling the function for each element. The function is passed two arguments, the element and an index.
code::
['a', 'b', 'c'].do({ arg item, i; [i, item].postln; });
::

method::reverseDo
Iterate over the elements in reverse order, calling the function for each element. The function is passed two arguments, the element and an index.
code::
['a', 'b', 'c'].reverseDo({ arg item, i; [i, item].postln; });
::

method::collect
Answer a new collection which consists of the results of function evaluated for each item in the collection. The function is passed two arguments, the item and an integer index. See link::Classes/Collection:: helpfile for examples.

method::deepCollect
The same as link::#-collect::, but can look inside sub-arrays up to the specified strong::depth::.
code::
a = [99, [4,6,5], [[32]]];
a.deepCollect(1, {|item| item.isArray}).postln;
a.deepCollect(2, {|item| item.isArray}).postln;
a.deepCollect(3, {|item| item.isArray}).postln;
::

method::windex
Interprets the array as a list of probabilities which should sum to 1.0 and returns a random index value based on those probabilities.
code::
(
Array.fill(10, {
	[0.1, 0.6, 0.3].windex;
}).postln;
)
::

method::normalizeSum
Returns the Array resulting from :
code::
(this / this.sum)
::
so that the array will sum to 1.0.

This is useful for using with windex or wchoose.
code::
[1, 2, 3].normalizeSum.postln;
::

method::normalize
Returns a new Array with the receiver items normalized between strong::min:: and strong::max::.
code::
[1, 2, 3].normalize;			//default min=0, max= 1
[1, 2, 3].normalize(-20, 10);
::

method::perfectShuffle
Returns a copy of the receiver with its items split into two equal halves, then reconstructed by interleaving the two halves. note::use an even number of item pairs in order to not loose any items in the shuffle.::
code::
(
var y, z;
z = [ 1, 2, 3, 4, 5, 6 ];
y = z.perfectShuffle;
z.postln;
y.postln;
)
::

method::performInPlace
Performs a method in place, within a certain region [from..to], returning the same array.
code::
a = (0..10);
a.performInPlace(\normalizeSum, 3, 6);
::

method::rank
Rank is the number of dimensions in a multidimensional array.
code::
a = [4,7,6,8];
a.rank;
a = [[4,7],[6,8]];
a.rank;
::

method::shape
For a multidimensional array, returns the number of elements along each dimension.
code::
a = [4,7,6,8];
a.shape;
a = [[4,7],[6,8]];
a.shape;
::

method::reshape
For a multidimensional array, rearranges the data using the desired number of elements along each dimension. The data may be extended using wrapExtend if needed.
code::
a = [4,7,6,8];
a.reshape(2,2);
a.reshape(2,3);
::

method::find
Finds the starting index of a number of elements contained in the array.
code::
a = (0..10);
a.find([4, 5, 6]);
::

method::replace
Return a new array in which a number of elements have been replaced by another.
code::
a = (0..10) ++ (0..10);
a.replace([4, 5, 6], 100);
a.replace([4, 5, 6], [1734, 1985, 1860]);
::
this method is inherited by link::Classes/String:: :
code::
a = "hello world";
a.replace("world", "word");
::

method::asRandomTable
Return an integral table that can be used to generate random numbers with a specified distribution.
(see link::Guides/Randomness:: helpfile for a more detailed example)
code::
(
a = (0..100) ++ (100..50) / 100; // distribution
a = a.asRandomTable;
)
::

method::tableRand
Returns a new random number from a random table.
code::
(
a = (0..100) ++ (100..50) / 100; // distribution
a = a.asRandomTable;
20.do { a.tableRand.postln };
)
::

method::msgSize
Return the size of an osc message in bytes
code::
a = ["/s_new", "default", -1, "freq", 440];
a.msgSize;
::

method::bundleSize
Return the size of an osc bundle in bytes
code::
a = [["/s_new", "default", -1, "freq", 440], ["/s_new", "default", -1, "freq", 220]];
a.bundleSize;
::

method::asciiPlot
For an ArrayedCollection containing numbers (e.g. audio data) this renders a plot in the post window using asterisks and spaces (works best if you use a monospace font in your post window).
code::
a = (0, pi/10 .. 5pi).collect{|val| val.sin};
a.asciiPlot;
::