navigation map

Chapters:
  1: Introduction
  2: Simple example
  3: Invocation
  4: Finer Control
  5: X-Y Plots
  6: Contour Plots
  7: Image Plots
  8: Examples
  9: Gri Commands
  10: Programming
  11: Environment
  12: Emacs Mode
  13: History
  14: Installation
  15: Gri Bugs
  16: Test Suite
  17: Gri in Press
  18: Acknowledgments
  19: License

Indices:
  Concepts
  Commands
  Variables
index.html#Top ReversePolishMath.html#rpnMathematics Gri: Reverse Polish Mathematics Gri: RPN functions index.html#Top Gri: RPN functions

10.9.1: Stack Operators

Stack operators manipulate or display the stack.

`pop' removes the top item from the stack (see Unary Operators).

`dup' duplicates the top item on the stack (see Unary Operators).

`exch' reorders the top two items on the stack (see Binary Operators).

`pstack' prints the items on the stack (without changing the stack).

`roll_right' rolls the items to the right.

`roll_left' rolls the items to the left.

For example, the following shows how you might use `exch' or `roll_right' to change the sense of a subtraction.


show {rpn 1 2            -} " ... yields -1"
show {rpn 1 2 exch       -} " ... yields  1"
show {rpn 1 2 roll_right -} " ... yields  1"

navigation map