Handbook
Glossary
mnswap ( m n -- quot )
Factor handbook
»
The language
»
Combinators
»
Generalized shuffle words and combinators
»
Generalized shuffle words
Prev:
ndrop ( n -- )
Next:
nweave ( n -- quot )
Vocabulary
generalizations
Inputs
m
an
integer
n
an
integer
Outputs
None
Word description
Swaps the top
m
stack elements with the
n
elements directly underneath.
Examples
Some core words expressed in terms of
mnswap
:
swap
1 1 mnswap
rot
2 1 mnswap
-rot
1 2 mnswap
Definition
USING:
kernel
math
;
IN:
generalizations
MACRO:
mnswap
( m n -- quot )
1
+
'[
_
-nrot
]
swap
'[
_
_
napply
]
;