Handbook
Glossary
replace ( seq old new -- new-seq )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Splitting sequences
Prev:
split-lines ( seq -- seq' )
Vocabulary
splitting
Inputs
seq
a
sequence
old
a
sequence
new
a
sequence
Outputs
new-seq
a
sequence
Word description
Replaces every occurrence of
old
with
new
in the
seq
.
Examples
USING: io splitting ; "cool example is cool" "cool" "silly" replace print
silly example is silly
Definition
USING:
kernel
sequences
;
IN:
splitting
:
replace
( seq old new -- new-seq )
pick
[
[
split-subseq
]
dip
]
dip
join-as
;