Returns a FoscTypedSequenceableCollection.
A typed sequenceable collection.
| at | Gets item at index. |
| atAll | Gets items at indices. |
| copySeries | |
| includes | Answer true if item exists in collection. |
| indexOf | (abjad: index) |
| last | Return the last item. |
| occurrencesOf | (abjad: count) |
| == | |
| != |
| do | |
| iter |
| includes | |
| isCollection | |
| items | |
| size | Size of typed sequenceable collection. |
| pop | Removes last item. |
| remove | Remove item. |
| removeAt | Remove item at index. |
| collect | |
| reject | |
| select |
Example
x = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
x.collection;[ 1, 2, 3, 4 ]
x.items;[ 1, 2, 3, 4 ]
FoscTypedSequenceableCollection.dumpInterfaceFoscTypedSequenceableCollectionGets item at index.
Returns item.
Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a[2];3Gets items at indices.
Returns items.
Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a[(2..3)];[ 3, 4 ]Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a[1..2];[ 2, 3 ]
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a[1..];[ 2, 3, 4 ]
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a[..2];[ 1, 2, 3 ]
a = FoscTypedSequenceableCollection([1, 2, 3, 4, 5, 6, 7], Number);
a.copySeries(0, 2);[ 1, 3, 5, 7 ]Answer true if item exists in collection.
Returns boolean.
Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a.includes(3);true
a.includes(5);false(abjad: index)
Return the first index matching item.
Returns integer.
Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a.indexOf(3);2Return the last item.
Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a.last;4(abjad: count)
Return the number of occurrences of item in collection.
Returns integer.
Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a.occurrencesOf(3);1Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
b = FoscTypedSequenceableCollection([1, 2], Number);
a == b;false
a == a.copy;trueExample
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
b = FoscTypedSequenceableCollection([1, 2], Number);
a != b;true
a != a.copy;falseExample
x = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
x.do { |each| (each * 2).postln };[ 1, 2, 3, 4 ]Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a = a.iter;
5.collect { a.next };[ 1, 2, 3, 4, nil ]Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a.includes(4);trueExample
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a.isCollection;trueExample
x = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
x.items;[ 1, 2, 3, 4 ]Size of typed sequenceable collection.
Returns nonnegative integer.
Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a.size;4Removes last item.
Returns removed item
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a.pop;
a.inspect;FoscTypedSequenceableCollection([
1,
2,
3
])Remove item.
Returns removed item.
Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a.remove(2);
a.items;[ 1, 3, 4 ]Remove item at index.
Returns removed item.
Example
a = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
a.removeAt(1);
a.items;[ 1, 3, 4 ]Example
x = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
x = x.collect { |each| each * 2 };
x.inspect;FoscTypedSequenceableCollection([
2,
4,
6,
8
])Example
x = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
x = x.reject { |each| each.even };
x.inspect;FoscTypedSequenceableCollection([
1,
3
])Example
x = FoscTypedSequenceableCollection([1, 2, 3, 4], Number);
x = x.select { |each| each.even };
x.inspect;FoscTypedSequenceableCollection([
2,
4
])