295 lines
No EOL
26 KiB
HTML
295 lines
No EOL
26 KiB
HTML
<!doctype html><html lang='en'><head><title>List | SuperCollider 3.9.3 Help</title>
|
|
<link rel='stylesheet' href='./../scdoc.css' type='text/css' />
|
|
<link rel='stylesheet' href='./../frontend.css' type='text/css' />
|
|
<link rel='stylesheet' href='./../custom.css' type='text/css' />
|
|
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
|
|
<script>
|
|
var helpRoot = './..';
|
|
var scdoc_title = 'List';
|
|
var scdoc_sc_version = '3.9.3';
|
|
</script>
|
|
<script src='./../scdoc.js' type='text/javascript'></script>
|
|
<script src='./../docmap.js' type='text/javascript'></script>
|
|
<script src='./../prettify.js' type='text/javascript'></script>
|
|
<script src='./../lang-sc.js' type='text/javascript'></script>
|
|
</head>
|
|
<body onload='fixTOC();prettyPrint()'>
|
|
<div id='toc'>
|
|
<div id='toctitle'>List:</div>
|
|
<span class='toc_search'>Filter: <input id='toc_search'></span><ul class='toc'><li class='toc1'><a href='#description'>Description</a></li>
|
|
<ul class='toc'></ul><li class='toc1'><a href='#classmethods'>Class methods</a></li>
|
|
<ul class='toc'><li class='toc3'><a href='#*new'>new</a> </li>
|
|
<li class='toc3'><a href='#*newClear'>newClear</a> </li>
|
|
<li class='toc3'><a href='#*copyInstance'>copyInstance</a> </li>
|
|
<li class='toc3'><a href='#*newUsing'>newUsing</a> </li>
|
|
<li class='toc2'><a href='#Inherited%20class%20methods'>Inherited class methods</a></li>
|
|
</ul><li class='toc1'><a href='#instancemethods'>Instance methods</a></li>
|
|
<ul class='toc'><li class='toc3'><a href='#-asArray'>asArray</a> </li>
|
|
<li class='toc3'><a href='#-array'>array</a> </li>
|
|
<li class='toc3'><a href='#-array'>array</a> </li>
|
|
<li class='toc3'><a href='#-at'>at</a> </li>
|
|
<li class='toc3'><a href='#-clipAt'>clipAt</a> </li>
|
|
<li class='toc3'><a href='#-wrapAt'>wrapAt</a> </li>
|
|
<li class='toc3'><a href='#-foldAt'>foldAt</a> </li>
|
|
<li class='toc3'><a href='#-put'>put</a> </li>
|
|
<li class='toc3'><a href='#-clipPut'>clipPut</a> </li>
|
|
<li class='toc3'><a href='#-wrapPut'>wrapPut</a> </li>
|
|
<li class='toc3'><a href='#-foldPut'>foldPut</a> </li>
|
|
<li class='toc3'><a href='#-add'>add</a> </li>
|
|
<li class='toc3'><a href='#-addFirst'>addFirst</a> </li>
|
|
<li class='toc3'><a href='#-insert'>insert</a> </li>
|
|
<li class='toc3'><a href='#-pop'>pop</a> </li>
|
|
<li class='toc3'><a href='#-grow'>grow</a> </li>
|
|
<li class='toc3'><a href='#-removeAt'>removeAt</a> </li>
|
|
<li class='toc3'><a href='#-fill'>fill</a> </li>
|
|
<li class='toc3'><a href='#-do'>do</a> </li>
|
|
<li class='toc3'><a href='#-reverseDo'>reverseDo</a> </li>
|
|
<li class='toc3'><a href='#-pairsDo'>pairsDo</a> </li>
|
|
<li class='toc3'><a href='#-copyRange'>copyRange</a> </li>
|
|
<li class='toc3'><a href='#-copySeries'>copySeries</a> </li>
|
|
<li class='toc3'><a href='#-putSeries'>putSeries</a> </li>
|
|
<li class='toc3'><a href='#-reverse'>reverse</a> </li>
|
|
<li class='toc3'><a href='#-scramble'>scramble</a> </li>
|
|
<li class='toc3'><a href='#-mirror'>mirror</a> </li>
|
|
<li class='toc3'><a href='#-mirror1'>mirror1</a> </li>
|
|
<li class='toc3'><a href='#-mirror2'>mirror2</a> </li>
|
|
<li class='toc3'><a href='#-stutter'>stutter</a> </li>
|
|
<li class='toc3'><a href='#-pyramid'>pyramid</a> </li>
|
|
<li class='toc3'><a href='#-lace'>lace</a> </li>
|
|
<li class='toc3'><a href='#-permute'>permute</a> </li>
|
|
<li class='toc3'><a href='#-wrapExtend'>wrapExtend</a> </li>
|
|
<li class='toc3'><a href='#-foldExtend'>foldExtend</a> </li>
|
|
<li class='toc3'><a href='#-slide'>slide</a> </li>
|
|
<li class='toc3'><a href='#-dump'>dump</a> </li>
|
|
<li class='toc3'><a href='#-clear'>clear</a> </li>
|
|
<li class='toc2'><a href='#Inherited%20instance%20methods'>Inherited instance methods</a></li>
|
|
<li class='toc2'><a href='#Undocumented%20instance%20methods'>Undocumented instance methods</a></li>
|
|
<ul class='toc'><li class='toc3'><a href='#-asList'>asList</a> </li>
|
|
<li class='toc3'><a href='#-copy'>copy</a> </li>
|
|
<li class='toc3'><a href='#-doAdjacentPairs'>doAdjacentPairs</a> </li>
|
|
<li class='toc3'><a href='#-first'>first</a> </li>
|
|
<li class='toc3'><a href='#-last'>last</a> </li>
|
|
<li class='toc3'><a href='#-rotate'>rotate</a> </li>
|
|
<li class='toc3'><a href='#-setCollection'>setCollection</a> </li>
|
|
<li class='toc3'><a href='#-size'>size</a> </li>
|
|
<li class='toc3'><a href='#-swap'>swap</a> </li>
|
|
</ul></ul></ul></div><div class='contents'>
|
|
<div id='menubar'></div>
|
|
<div class='header'>
|
|
<div id='label'>
|
|
<span id='folder'>Classes</span>
|
|
| <span id='categories'><a href='./../Browse.html#Collections'>Collections</a> > <a href='./../Browse.html#Collections>Ordered'>Ordered</a></span>
|
|
</div><h1>List<span id='superclasses'> : <a href="../Classes/SequenceableCollection.html">SequenceableCollection</a> : <a href="../Classes/Collection.html">Collection</a> : <a href="../Classes/Object.html">Object</a></span>
|
|
</h1>
|
|
<div id='summary'>list of items of variable size</div>
|
|
</div>
|
|
<div class='subheader'>
|
|
<div id='filename'>Source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Collections/List.sc' title='/Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Collections/List.sc'>List.sc</a></div><div id='subclasses'>Subclasses: <a href="../Classes/SortedList.html">SortedList</a></div>
|
|
<div id='related'>See also: <a href="./../Classes/Array.html">Array</a></div>
|
|
</div>
|
|
<h2><a class='anchor' name='description'>Description</a></h2>
|
|
|
|
<p>List is a subclass of SequenceableCollection with unlimited growth in size. Although not a subclass of <a href="./../Classes/Array.html">Array</a> or its superclass <a href="./../Classes/ArrayedCollection.html">ArrayedCollection</a> it uses an Array in its implementation and is in many cases interchangeable with one. (List implements many of the same methods as Array.)
|
|
<p>Arrays have a fixed maximum size. If you add beyond that size a new Array is created and returned, but you must use an assignment statement or the new array will be lost. (See the <a href="./../Classes/Array.html">Array</a> helpfile.) List has no size limitation and is thus more flexible, but has slightly more overhead.<pre class='code prettyprint lang-sc'>(
|
|
x = Array.new(3);
|
|
y = List.new(3);
|
|
5.do({ arg i; z = x.add(i); y.add(i); });
|
|
x.postln; z.postln; y.postln;
|
|
)</pre>
|
|
|
|
<p>Many of List's methods are inherited from <a href="./../Classes/SequenceableCollection.html">SequenceableCollection</a> or <a href="./../Classes/Collection.html">Collection</a> and are documented in those helpfiles.<h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
|
|
<h3 class='method-code'><span class='method-prefix'>List.</span><a class='method-name' name='*new' href='./../Overviews/Methods.html#new'>new</a>(<span class='argstr'>size: 8</span>)</h3>
|
|
<div class='method'>
|
|
<p>Creates a List with the initial capacity given by <strong>size</strong>.</div><h3 class='method-code'><span class='method-prefix'>List.</span><a class='method-name' name='*newClear' href='./../Overviews/Methods.html#newClear'>newClear</a>(<span class='argstr'>size: 0</span>)</h3>
|
|
<div class='method'>
|
|
<p>Creates a List with the initial capacity given by <strong>size</strong> and slots filled with nil.</div><h3 class='method-code'><span class='method-prefix'>List.</span><a class='method-name' name='*copyInstance' href='./../Overviews/Methods.html#copyInstance'>copyInstance</a>(<span class='argstr'>aList</span>)</h3>
|
|
<div class='method'>
|
|
<p>Creates a List by copying <strong>aList</strong>'s array variable.</div><h3 class='method-code'><span class='method-prefix'>List.</span><a class='method-name' name='*newUsing' href='./../Overviews/Methods.html#newUsing'>newUsing</a>(<span class='argstr'>anArray</span>)</h3>
|
|
<div class='method'>
|
|
<p>Creates a List using <strong>anArray</strong>.</div><h3><a class='anchor' name='Inherited%20class%20methods'>Inherited class methods</a></h3>
|
|
<div id='inheritedclassmets'></div><h2><a class='anchor' name='instancemethods'>Instance Methods</a></h2>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-asArray' href='./../Overviews/Methods.html#asArray'>asArray</a></h3>
|
|
<div class='method'>
|
|
<p>Returns a new <a href="./../Classes/Array.html">Array</a> based upon this List.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-array' href='./../Overviews/Methods.html#array'>array</a></h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-array' href='./../Overviews/Methods.html#array'>array</a> = value</h3>
|
|
<div class='method'>
|
|
<p>Returns the List's Array, allowing it to be manipulated directly. This should only be necessary for exotic manipulations not implemented in List or its superclasses.<pre class='code prettyprint lang-sc'>(
|
|
x = List[1, 2, 3];
|
|
x.array.add("foo");
|
|
x.postln;
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-array' href='./../Overviews/Methods.html#array'>array</a></h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-array' href='./../Overviews/Methods.html#array'>array</a> = value</h3>
|
|
<div class='method'>
|
|
<p>Sets the List's Array.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-at' href='./../Overviews/Methods.html#at'>at</a>(<span class='argstr'>i</span>)</h3>
|
|
<div class='method'>
|
|
<p>Return the item at <strong>index</strong>.<pre class='code prettyprint lang-sc'>List[ 1, 2, 3 ].at(0).postln;</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-clipAt' href='./../Overviews/Methods.html#clipAt'>clipAt</a>(<span class='argstr'>i</span>)</h3>
|
|
<div class='method'>
|
|
<p>Same as <a href="#-at">-at</a>, but values for <strong>index</strong> greater than the size of the List will be clipped to the last index.<pre class='code prettyprint lang-sc'>y = List[ 1, 2, 3 ];
|
|
y.clipAt(13).postln;</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-wrapAt' href='./../Overviews/Methods.html#wrapAt'>wrapAt</a>(<span class='argstr'>i</span>)</h3>
|
|
<div class='method'>
|
|
<p>Same as <a href="#-at">-at</a>, but values for <strong>index</strong> greater than the size of the List will be wrapped around to 0.<pre class='code prettyprint lang-sc'>y = List[ 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</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-foldAt' href='./../Overviews/Methods.html#foldAt'>foldAt</a>(<span class='argstr'>i</span>)</h3>
|
|
<div class='method'>
|
|
<p>Same as <a href="#-at">-at</a>, but values for <strong>index</strong> greater than the size of the List will be folded back.<pre class='code prettyprint lang-sc'>y = List[ 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</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-put' href='./../Overviews/Methods.html#put'>put</a>(<span class='argstr'>i</span>, <span class='argstr'>item</span>)</h3>
|
|
<div class='method'>
|
|
<p>Put <strong>item</strong> at <strong>index</strong>, replacing what is there.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-clipPut' href='./../Overviews/Methods.html#clipPut'>clipPut</a>(<span class='argstr'>i</span>, <span class='argstr'>item</span>)</h3>
|
|
<div class='method'>
|
|
<p>Same as <a href="#-put">-put</a>, but values for <strong>index</strong> greater than the size of the List will be clipped to the last index.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-wrapPut' href='./../Overviews/Methods.html#wrapPut'>wrapPut</a>(<span class='argstr'>i</span>, <span class='argstr'>item</span>)</h3>
|
|
<div class='method'>
|
|
<p>Same as <a href="#-put">-put</a>, but values for <strong>index</strong> greater than the size of the List will be wrapped around to 0.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-foldPut' href='./../Overviews/Methods.html#foldPut'>foldPut</a>(<span class='argstr'>i</span>, <span class='argstr'>item</span>)</h3>
|
|
<div class='method'>
|
|
<p>Same as <a href="#-put">-put</a>, but values for <strong>index</strong> greater than the size of the List will be folded back.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-add' href='./../Overviews/Methods.html#add'>add</a>(<span class='argstr'>item</span>)</h3>
|
|
<div class='method'>
|
|
<p>Adds an <strong>item</strong> to the end of the List.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-addFirst' href='./../Overviews/Methods.html#addFirst'>addFirst</a>(<span class='argstr'>item</span>)</h3>
|
|
<div class='method'>
|
|
<p>Inserts the <strong>item</strong> at the beginning of the List.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-insert' href='./../Overviews/Methods.html#insert'>insert</a>(<span class='argstr'>index</span>, <span class='argstr'>item</span>)</h3>
|
|
<div class='method'>
|
|
<p>Inserts the <strong>item</strong> into the contents of the List at the indicated <strong>index</strong>.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-pop' href='./../Overviews/Methods.html#pop'>pop</a></h3>
|
|
<div class='method'>
|
|
<p>Remove and return the last element of the List.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-grow' href='./../Overviews/Methods.html#grow'>grow</a>(<span class='argstr'>sizeIncrease</span>)</h3>
|
|
<div class='method'>
|
|
<p>Increase the size of the List by <strong>sizeIncrease</strong> number of slots.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-removeAt' href='./../Overviews/Methods.html#removeAt'>removeAt</a>(<span class='argstr'>index</span>)</h3>
|
|
<div class='method'>
|
|
<p>Remove and return the element at <strong>index</strong>, shrinking the size of the List.<pre class='code prettyprint lang-sc'>y = List[ 1, 2, 3 ];
|
|
y.removeAt(1);
|
|
y.postln;</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-fill' href='./../Overviews/Methods.html#fill'>fill</a>(<span class='argstr'>item</span>)</h3>
|
|
<div class='method'>
|
|
<p>Inserts the item into the contents of the receiver, possibly returning a new collection.<div class='note'><span class='notelabel'>NOTE:</span> the difference between this and <a href="./../Classes/Collection.html#fill">Collection's *fill</a>.</div>
|
|
<p><pre class='code prettyprint lang-sc'>(
|
|
var z;
|
|
z = List[1, 2, 3, 4];
|
|
z.fill(4).postln;
|
|
z.fill([1,2,3,4]).postln;
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-do' href='./../Overviews/Methods.html#do'>do</a>(<span class='argstr'>function</span>)</h3>
|
|
<div class='method'>
|
|
<p>Iterate over the elements in order, calling the function for each element. The function is passed two arguments, the element and an index.<pre class='code prettyprint lang-sc'>List['a', 'b', 'c'].do({ arg item, i; [i, item].postln; });</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-reverseDo' href='./../Overviews/Methods.html#reverseDo'>reverseDo</a>(<span class='argstr'>function</span>)</h3>
|
|
<div class='method'>
|
|
<p>Iterate over the elements in reverse order, calling the function for each element. The function is passed two arguments, the element and an index.<pre class='code prettyprint lang-sc'>List['a', 'b', 'c'].reverseDo({ arg item, i; [i, item].postln; });</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-pairsDo' href='./../Overviews/Methods.html#pairsDo'>pairsDo</a>(<span class='argstr'>function</span>)</h3>
|
|
<div class='method'>
|
|
<p>Calls function for each subsequent pair of elements in the List. The function is passed the two elements and an index.<pre class='code prettyprint lang-sc'>List[1, 2, 3, 4, 5, 6].pairsDo({ arg a, b; [a, b].postln; });</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-copyRange' href='./../Overviews/Methods.html#copyRange'>copyRange</a>(<span class='argstr'>start</span>, <span class='argstr'>end</span>)</h3>
|
|
<div class='method'>
|
|
<p>Return a new List which is a copy of the indexed slots of the receiver from start to end.<pre class='code prettyprint lang-sc'>(
|
|
var y, z;
|
|
z = List[1, 2, 3, 4, 5];
|
|
y = z.copyRange(1,3);
|
|
z.postln;
|
|
y.postln;
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-copySeries' href='./../Overviews/Methods.html#copySeries'>copySeries</a>(<span class='argstr'>first</span>, <span class='argstr'>second</span>, <span class='argstr'>last</span>)</h3>
|
|
<div class='method'>
|
|
<p>Return a new List consisting of the values starting at <strong>first</strong>, then every step of the distance between <strong>first</strong> and <strong>second</strong>, up until <strong>last</strong>.<pre class='code prettyprint lang-sc'>(
|
|
var y, z;
|
|
z = List[1, 2, 3, 4, 5, 6];
|
|
y = z.copySeries(0, 2, 5);
|
|
y.postln;
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-putSeries' href='./../Overviews/Methods.html#putSeries'>putSeries</a>(<span class='argstr'>first</span>, <span class='argstr'>second</span>, <span class='argstr'>last</span>, <span class='argstr'>value</span>)</h3>
|
|
<div class='method'>
|
|
<p>Put <strong>value</strong> at every index starting at <strong>first</strong>, then every step of the distance between <strong>first</strong> and <strong>second</strong>, up until <strong>last</strong>.<pre class='code prettyprint lang-sc'>(
|
|
var y, z;
|
|
z = List[1, 2, 3, 4, 5, 6];
|
|
y = z.putSeries(0, 2, 5, "foo");
|
|
y.postln;
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-reverse' href='./../Overviews/Methods.html#reverse'>reverse</a></h3>
|
|
<div class='method'>
|
|
<p>Return a new List whose elements are reversed.<pre class='code prettyprint lang-sc'>(
|
|
var y, z;
|
|
z = List[1, 2, 3, 4];
|
|
y = z.reverse;
|
|
z.postln;
|
|
y.postln;
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-scramble' href='./../Overviews/Methods.html#scramble'>scramble</a></h3>
|
|
<div class='method'>
|
|
<p>Returns a new List whose elements have been scrambled. The receiver is unchanged.<pre class='code prettyprint lang-sc'>List[1, 2, 3, 4, 5, 6].scramble.postln;</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-mirror' href='./../Overviews/Methods.html#mirror'>mirror</a></h3>
|
|
<div class='method'>
|
|
<p>Return a new List which is the receiver made into a palindrome. The receiver is unchanged.<pre class='code prettyprint lang-sc'>List[1, 2, 3, 4].mirror.postln;</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-mirror1' href='./../Overviews/Methods.html#mirror1'>mirror1</a></h3>
|
|
<div class='method'>
|
|
<p>Return a new List which is the receiver made into a palindrome with the last element removed. This is useful if the list will be repeated cyclically, the first element will not get played twice. The receiver is unchanged.<pre class='code prettyprint lang-sc'>List[1, 2, 3, 4].mirror1.postln;</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-mirror2' href='./../Overviews/Methods.html#mirror2'>mirror2</a></h3>
|
|
<div class='method'>
|
|
<p>Return a new List which is the receiver concatenated with a reversal of itself. The center element is duplicated. The receiver is unchanged.<pre class='code prettyprint lang-sc'>List[1, 2, 3, 4].mirror2.postln;</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-stutter' href='./../Overviews/Methods.html#stutter'>stutter</a>(<span class='argstr'>n: 2</span>)</h3>
|
|
<div class='method'>
|
|
<p>Return a new List whose elements are repeated <strong>n</strong> times. The receiver is unchanged.<pre class='code prettyprint lang-sc'>List[1, 2, 3].stutter(2).postln;</pre>
|
|
|
|
<p>rotate Return a new List whose elements are in rotated order. Negative <strong>n</strong> values rotate left, positive <strong>n</strong> values rotate right. The receiver is unchanged.<pre class='code prettyprint lang-sc'>List[1, 2, 3, 4, 5].rotate(1).postln;
|
|
List[1, 2, 3, 4, 5].rotate(-1).postln;
|
|
List[1, 2, 3, 4, 5].rotate(3).postln;</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-pyramid' href='./../Overviews/Methods.html#pyramid'>pyramid</a>(<span class='argstr'>patternType: 1</span>)</h3>
|
|
<div class='method'>
|
|
<p>Return a new List whose elements have been reordered via one of 10 "counting" algorithms. The algorithms are numbered 1 through 10. Run the examples to see the algorithms.<pre class='code prettyprint lang-sc'>List[1, 2, 3, 4].pyramid(1).postln;
|
|
|
|
(
|
|
10.do({ arg i;
|
|
List[1, 2, 3, 4].pyramid(i + 1).postcs;
|
|
});
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-lace' href='./../Overviews/Methods.html#lace'>lace</a>(<span class='argstr'>length</span>)</h3>
|
|
<div class='method'>
|
|
<p>Returns a new List whose elements are interlaced sequences of the elements of the receiver's subcollections, up to size <strong>length</strong>. The receiver is unchanged.<pre class='code prettyprint lang-sc'>(
|
|
x = List[ [1, 2, 3], 6, List["foo", 'bar']];
|
|
y = x.lace(12);
|
|
x.postln;
|
|
y.postln;
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-permute' href='./../Overviews/Methods.html#permute'>permute</a>(<span class='argstr'>nthPermutation</span>)</h3>
|
|
<div class='method'>
|
|
<p>Returns a new List whose elements are the <strong>nthPermutation</strong> of the elements of the receiver. The receiver is unchanged.<pre class='code prettyprint lang-sc'>(
|
|
x = List[ 1, 2, 3];
|
|
6.do({|i| x.permute(i).postln;});
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-wrapExtend' href='./../Overviews/Methods.html#wrapExtend'>wrapExtend</a>(<span class='argstr'>length</span>)</h3>
|
|
<div class='method'>
|
|
<p>Returns a new List whose elements are repeated sequences of the receiver, up to size <strong>length</strong>. The receiver is unchanged.<pre class='code prettyprint lang-sc'>(
|
|
x = List[ 1, 2, 3, "foo", 'bar' ];
|
|
y = x.wrapExtend(9);
|
|
x.postln;
|
|
y.postln;
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-foldExtend' href='./../Overviews/Methods.html#foldExtend'>foldExtend</a>(<span class='argstr'>length</span>)</h3>
|
|
<div class='method'>
|
|
<p>Same as <a href="#-wrapExtend">-wrapExtend</a> but the sequences fold back on the list elements.<pre class='code prettyprint lang-sc'>(
|
|
x = List[ 1, 2, "foo"];
|
|
y = x.foldExtend(9);
|
|
x.postln;
|
|
y.postln;
|
|
)</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-slide' href='./../Overviews/Methods.html#slide'>slide</a>(<span class='argstr'>windowLength: 3</span>, <span class='argstr'>stepSize: 1</span>)</h3>
|
|
<div class='method'>
|
|
<p>Return a new List whose elements are repeated subsequences from the receiver. Easier to demonstrate than explain.<pre class='code prettyprint lang-sc'>List[1, 2, 3, 4, 5, 6].slide(3, 1).postcs;
|
|
List[1, 2, 3, 4, 5, 6].slide(3, 2).postcs;
|
|
List[1, 2, 3, 4, 5, 6].slide(4, 1).postcs;</pre>
|
|
</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-dump' href='./../Overviews/Methods.html#dump'>dump</a></h3>
|
|
<div class='method'>
|
|
<p>Dump the List's Array.</div><h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-clear' href='./../Overviews/Methods.html#clear'>clear</a></h3>
|
|
<div class='method'>
|
|
<p>Replace the List's Array with a new empty one.</div><h3><a class='anchor' name='Inherited%20instance%20methods'>Inherited instance methods</a></h3>
|
|
<div id='inheritedinstmets'></div><h3><a class='anchor' name='Undocumented%20instance%20methods'>Undocumented instance methods</a></h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-asList' href='./../Overviews/Methods.html#asList'>asList</a></h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-copy' href='./../Overviews/Methods.html#copy'>copy</a></h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-doAdjacentPairs' href='./../Overviews/Methods.html#doAdjacentPairs'>doAdjacentPairs</a>(<span class='argstr'>function</span>)</h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-first' href='./../Overviews/Methods.html#first'>first</a></h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-last' href='./../Overviews/Methods.html#last'>last</a></h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-rotate' href='./../Overviews/Methods.html#rotate'>rotate</a>(<span class='argstr'>n: 1</span>)</h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-setCollection' href='./../Overviews/Methods.html#setCollection'>setCollection</a>(<span class='argstr'>aColl</span>)</h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-size' href='./../Overviews/Methods.html#size'>size</a></h3>
|
|
<h3 class='method-code'><span class='method-prefix'>.</span><a class='method-name' name='-swap' href='./../Overviews/Methods.html#swap'>swap</a>(<span class='argstr'>i</span>, <span class='argstr'>j</span>)</h3>
|
|
<div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/List.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/List.schelp</a><br>link::Classes/List::<br></div></div></body></html> |