So far we have seen how words like "+ " and " */ "
can be linked together like components in a circuit, but sometimes we will
need to reorder the arguments by manipulating the stack. For this we use the
stack control words, which may be thought of as the wiring between
Other manipulations than reordering are possible. One may wish to make a copy
of an item, or to dispose of an item without processing it further.
To facilitate this Forth has a good selection of stack control words. These are
some of the more common ones.
SWAP ( a b--b a)
ROT ( a b c--b c a)
DUP ( a--a a)
OVER ( a b--a b a)
DROP ( a--)
In the next section we will see how these are put to use.
Now you can go on to the
or return to the