Handbook
Glossary
Complex shuffle words
Factor handbook
»
The language
»
Shuffle words
Prev:
swap ( x y -- y x )
These shuffle words tend to make code difficult to read and to reason about. Code that uses them should almost always be rewritten using
Lexical variables
or
Dataflow combinators
.
Duplicating stack elements deep in the stack:
dupd
( x y -- x x y )
Permuting stack elements deep in the stack:
swapd
( x y z -- y x z )
rot
( x y z -- y z x )
-rot
( x y z -- z x y )