FoscSequence

Returns a FoscSequence.


Description

A sequence.


Attributes Summary

Instance Methods

==
!=
++
add
addAll
any
at
atAll
copySeries
do
doAdjacentPairs
every
first
flat
flatten
hash !!!TODO: not yet implemented
includes
insert
indexOf
isEmpty
last
lastIndex
notEmpty
put
remove
removeAt
reverseDo
separate Groups items by predicate function.
size


Instance Methods


==

  1. Example

    a = FoscSequence(#[1,2,3]);
    b = FoscSequence(#[1,2,3]);
    c = FoscSequence([1,2,4]);
    a == b;
    true
    a == c;
    false


!=

  1. Example

    a = FoscSequence(#[1,2,3]);
    b = FoscSequence(#[1,2,3]);
    c = FoscSequence([1,2,4]);
    a != b;
    false
    a != c;
    true


++

  1. Example

    a = FoscSequence(#[1,2,3]);
    b = FoscSequence([4,5,6]);
    c = a ++ b;
    c.items;
    [ 1, 2, 3, 4, 5, 6 ]


add

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.add(4);
    a.items;
    [ 1, 2, 3, 4 ]


addAll

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.addAll([4,5]);
    a.items;
    [ 1, 2, 3, 4, 5 ]


any

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.any { |item| item == 1 };
    true
    a.any { |item| item == 4 };
    false


at

  1. Example

    a = FoscSequence(#[1,2,3]);
    a[1];
    2


atAll

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.atAll(#[0,2]);
    [ 1, 3 ]
    a.atAll(#[0,3]);
    [ 1, nil ]


copySeries

  1. Example

    a = FoscSequence(#[1,2,3]);
    a[1..];
    [ 2, 3 ]


do

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.do { |each, i| [each, i].postln };
    FoscSequence.new


doAdjacentPairs

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.doAdjacentPairs { |a, b, i| [a, b, i].postln };
    FoscSequence.new


every

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.every { |item| item < 4 };
    true
    a.every { |item| item > 2 };
    false


first

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.first;
    1


flat

  1. Example

    a = FoscSequence(#[[1, 2, 3], [[4, 5], [[6]]]]);
    b = a.flat;
    b.items;
    [ 1, 2, 3, 4, 5, 6 ]


flatten

  1. Example

    a = FoscSequence(#[[1, 2, 3], [[4, 5], [[6]]]]);
    FoscSequence.new
    b = a.flatten(1);
    b.items;
    [ 1, 2, 3, [ 4, 5 ], [ [ 6 ] ] ]
    c = a.flatten(2);
    c.items;
    [ 1, 2, 3, 4, 5, [ 6 ] ]


hash

!!!TODO: not yet implemented


includes

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.includes(2);
    true
    a.includes(4);
    false


insert

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.insert(1, 4);
    a.items;
    [ 1, 4, 2, 3 ]


indexOf

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.indexOf(2);
    a.indexOf(4);


isEmpty

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.isEmpty;
    false
    a = FoscSequence([]);
    a.isEmpty;
    true


last

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.last;
    3


lastIndex

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.lastIndex;
    2


notEmpty

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.notEmpty;
    true
    a = FoscSequence([]);
    a.notEmpty;
    false


put

  1. Example

    a = FoscSequence(#[1,2,3]);
    a[1] = 4;
    a.items;
    prFormatCodeString interpret initial failed: a PrimitiveFailedError
    
        a = FoscSequence(#[1,2,3]);
        a[1] = 4;
    


remove

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.remove(3);
    a.items;
    prFormatCodeString interpret initial failed: a PrimitiveFailedError
    
        a = FoscSequence(#[1,2,3]);
        a.remove(3);
    


removeAt

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.removeAt(1);
    a.items;
    prFormatCodeString interpret initial failed: a PrimitiveFailedError
    
        a = FoscSequence(#[1,2,3]);
        a.removeAt(1);
    


reverseDo

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.reverseDo { |each, i| [each, i].postln };
    FoscSequence.new


separate

Groups items by predicate function.

  1. Example

    a = FoscSequence([1,2,3,5,6]);
    b = a.separate { |a, b| (b - a) >= 2 };
    b.items;
    [ [ 1, 2, 3 ], [ 5, 6 ] ]


size

  1. Example

    a = FoscSequence(#[1,2,3]);
    a.size;
    3