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
newa sequence
froma non-negative integer
toa non-negative integer
seqa sequence


Outputs
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 ;