Sequence operations
Factor handbook » The language » Collections

Next:Virtual sequences


A sequence is a finite, linearly-ordered collection of elements. Words for working with sequences are in the sequences vocabulary.

Sequences implement a protocol:
Sequence protocol
The f object as a sequence

Sequence utility words can operate on any object whose class implements the sequence protocol. Most implementations are backed by storage. Some implementations obtain their elements from an underlying sequence, or compute them on the fly. These are known as Virtual sequences.
Accessing sequence elements
Sequence combinators
Adding and removing sequence elements
Appending sequences
Subsequences and slices
Reshaping sequences
Testing sequences
Searching sequences
Comparing sequences
Splitting sequences
Groups and clumps
Destructive sequence operations
Treating sequences as stacks
Sorting sequences
Binary search
Sets
Trimming sequences
Cartesian product operations
Deep sequence combinators

Using sequences for looping:
Counted loops
Numeric ranges

Using sequences for control flow:
Control flow with sequences

For inner loops:
Unsafe sequence operations

Implementing sequence combinators:
Implementing sequence combinators