Gri: `rpnfunction' command

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 | ### 9.3.40: ``rpnfunction`'
    `rpnfunction name replacement-words'
Create a new keyword for use in rpn expressions. Inside any RPN expression which follows this line, the word ``name`' will be substituted with the indicated replacement words. For example, the following shows the definition and use of a function which computes the sine of twice an angle, by multiplying whatever is on the stack by ``2`', and then taking the sine of the result.
    rpnfunction sin2 2 * sin
    show "expect the number 1 to follow: " {rpn 45 sin2}
The replacement words will have any synonyms in them translated first, unless they start with an underscore followed by a double backslash. Similarly, variables are substituted unless they start with an underscore. These exceptions are to allow the use of the ``defined`' operator (see rpn Mathematics). Note: The mathematical constants ``e`' and ``pi`' are stored using ``rpnfunctions`'. Also, two ``rpnfunctions`' are provided for finding the slope and intercept of a line joining two points, e.g.
    # Expect answers 1 and 10 ...
    show "slope=" {rpn 0 1 1 11 linear_slope}
    show "inter=" {rpn 0 1 1 11 linear_intercept}
These are useful in ``set grid missing above .intercept. .slope.`' and ``set z missing above .intercept. .slope.`'.