Handbook
Glossary
exchange ( m n seq -- )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Destructive sequence operations
Prev:
move ( to from seq -- )
Next:
copy ( src i dst -- )
Vocabulary
sequences
Inputs
m
a non-negative integer
n
a non-negative integer
seq
a mutable sequence
Outputs
None
Word description
Exchanges the
m
th and
n
th elements of
seq
.
Definition
USING:
kernel
sequences.private
;
IN:
sequences
:
exchange
( m n seq -- )
[
nip
bounds-check
2drop
]
[
bounds-check
3drop
]
[
exchange-unsafe
]
3tri
;