Handbook
Glossary
reverse! ( seq -- seq )
Factor handbook
»
The language
»
Collections
»
Sequence operations
»
Destructive sequence operations
Prev:
append! ( seq1 seq2 -- seq1 )
Next:
move ( to from seq -- )
Vocabulary
sequences
Inputs
seq
a mutable sequence
Outputs
seq
a mutable sequence
Word description
Reverses a sequence in-place and outputs that sequence.
Side effects
Modifies
seq
See also
reverse
,
<reversed>
Definition
USING:
kernel
math
sequences.private
;
IN:
sequences
:
reverse!
( seq -- seq )
[
[
midpoint@
]
[
length
]
[
]
tri
[
[
over
-
1
-
]
dip
exchange-unsafe
]
2curry
each-integer
]
keep
;