OpenBoot 3.x Quick Reference

Stack Manipulation Commands

Table 1-19 Stack Manipulation Commands

-rot

( n1 n2 n3 -- n3 n1 n2 )

Inversely rotate three stack items. 

>r

( n -- )

Move a stack item to the return stack. 

?dup

( n -- n n | 0 )

Duplicate the top stack item if non-zero. 

2drop

( n1 n2 -- )

Remove top two items from the stack. 

2dup

( n1 n2 -- n1 n2 n1 n2 )

Duplicate top two stack items. 

2over

( n1 n2 n3 n4 -- n1 n2 n3 n4 n1 n2 )

Copy second two stack items. 

2swap

( n1 n2 n3 n4 -- n3 n4 n1 n2 )

Exchange top two pairs of stack items. 

clear

( ??? -- )

Empty the stack. 

depth

( ??? -- ??? +n )

Return the number of items on the stack. 

drop

( n -- )

Remove the top item from the stack. 

dup

( n -- n n )

Duplicate the top stack item. 

over

( n1 n2 -- n1 n2 n1 )

Copy the second stack item to the top of the stack. 

pick

( nu ... n1 n0 u -- nu ... n1 n0 nu )

Copy u-th stack item (1 pick = over).

r>

( -- n )

Move a return stack item to the stack. 

r@

( -- n )

Copy the top of the return stack to the stack.  

roll

( nu ... n1 n0 u -- nu-1 ... n1 n0 nu )

Rotate u stack items (2 roll = rot).

rot

( n1 n2 n3 -- n2 n3 n1 )

Rotate three stack items. 

swap

( n1 n2 -- n2 n1 )

Exchange the top two stack items. 

tuck

( n1 n2 -- n2 n1 n2 )

Copy the top stack item below the second item.