Next: , Previous: , Up: Top   [Contents][Index]

10 Calculator Mode

LUX mimics a regular calculator if you enter calculator mode using the calculator command. You can only enter this mode from the main execution level (i.e., not from inside a subroutine or function). This mode is indicated by the clc> prompt, and you can leave it again by issuing a return command.

In calculator mode, you modify the value of variable $ by issuing calculator commands. The value must be a numerical scalar or array, or a string. After each command has been completed, the current value of $ is displayed. Each command is ended by a newline and consists of a LUX expression or simple assignment implicitly or explicitly containing $ as an operand. This variable is an implicit operand in the following cases: binary operations where the first operand is missing, simple assignments where the left-hand side is missing, and simple assignments that consist of just the name of a single-argument function (which is applied to the value of $).

If a command consists of just a single name, then it is taken to be the name of a single-argument function that is to be applied to the current value. If you wish to assign the value of a variable, then prepend an equal sign.

See also: calculator