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 )


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.

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


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