subseq ( from to seq -- subseq )
Factor handbook > The language > Collections > Sequence operations > Subsequences and slices

Next:subseq-as ( from to seq exemplar -- subseq )


Inputs and outputs
froma non-negative integer
toa non-negative integer
seqa sequence
subseqa new sequence

Word description
Outputs a new sequence consisting of all elements starting from and including from, and up to but not including to.

Throws an error if from or to is out of bounds.

See also


: subseq ( from to seq -- subseq ) dup subseq-as ; inline