replace-slice ( new from to seq -- seq' )
Factor handbook > The language > Collections > Sequence operations > Subsequences and slices

Prev:cut-slice ( seq n -- before-slice after-slice )


Vocabulary
sequences

Inputs and outputs
newa sequence
froma non-negative integer
toa non-negative integer
seqa sequence
seq'a sequence


Word description
Replaces a range of elements beginning at index from and ending before index to with a new sequence.

Errors
Throws an error if new contains elements whose types are not permissible in seq.

Definition

: replace-slice ( new from to seq -- seq' )
snip-slice surround ;