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: RPN unary operators Gri: RPN column manipulation index.html#Top Gri: RPN column manipulation

10.9.6: Solitary Operators

Solitary operators do not act on items on the stack; rather, they generate items themselves and insert them on the stack.

The solitary operators are illustrated below, in alphabetical order.

{rpn argc}
Yields number of command-line arguments given by the user when Gri was invoked. Thus, invoking Gri as


gri myfile.gri file1.dat file2.dat

yields 3, for arguments `myfile.gri', `file1.dat', and `file2.dat'. These arguments are accessible through the `argv' unary operator (see Unary Operators).

{rpn e}
Yields the base of natural logarithms, i.e. `2.718'...

{rpn pi}
Yields Pi, i.e. `3.141'...

{rpn rand}
Generate a random number in the range 0 to 1, using the C subroutine `drand48()' if it is available, otherwise the less well-distributed `rand()' subroutine.

{rpn wordc}
Returns number of words used in invoking the present command. Similar to the `\.words.' synonym (see Local Synonyms). Example:


`let us test .it.'
{
  show "This command has " {rpn wordc} " words"
}
let us test 10
let us test {rpn 3 1 +}
let us test "this"
let us test "this thing"

The operator `wordv' may be used to extract the words of the command (see Unary Operators).

navigation map