dc: Stack Control
5 Stack Control
***************
'c'
Clears the stack, rendering it empty.
'd'
Duplicates the value on the top of the stack, pushing another copy
of it. Thus, '4d*p' computes 4 squared and prints it.
'r'
Reverses the order of (swaps) the top two values on the stack.
(This can also be accomplished with the sequence 'SaSbLaLb'.)
(This command is a GNU extension.)
'R'
Pops the top-of-stack as an integer N. Cyclically rotates the top
N items on the updated stack. If N is positive, then the rotation
direction will make the topmost element the second-from top; if N
is negative, then the rotation will make the topmost element the
N-th element from the top. If the stack depth is less than N then
the entire stack is rotated (in the appropriate direction), without
any error being reported. (This command is a GNU extension.)