A command is an order to the system to do something. Some commands cause visible results (such as calling for input or output); others, usually called declarations, set options, define properties of variables, or define procedures. Commands are formally defined as a statement followed by a terminator
⟨command⟩ ::= ⟨statement⟩⟨terminator⟩ ⟨terminator⟩ ::= ;∣$
Some REDUCE commands and declarations are described in the following sub-sections.
- 6 Commands and Declarations
Not initially supported by Reduce.jl parser, see upstream docs for more information.
off declarations are available to the user for controlling various system options. Each option is represented by a switch name.
off take a list of switch names as argument and turn them on and off respectively, e.g.,
causes the system to print a message after each command giving the elapsed CPU time since the last command, or since
time was last turned off, or the session began. Another useful switch with interactive use is
demo, which causes the system to pause after each command in a file (with the exception of comments) until a
<Return> is typed on the terminal. This enables a user to set up a demonstration file and step through it command by command.
Takes a list of switch names as argument and turns them on.
Takes a list of switch names as argument and turns them off.
As with most declarations, arguments to
off may be strung together separated by commas. For example,
will turn off both the time messages and the demonstration switch.
We note here that while most
off commands are obeyed almost instantaneously, some trigger time-consuming actions such as reading in necessary modules from secondary storage.
A diagnostic message is printed if
off are used with a switch that is not known to the system. For example, if you misspell
demo and type
you will get the message
ERROR: Reduce: ***** demq not defined as switch
end has two separate uses.
- Its use in a
R"begin… end"bracket has been discussed in connection with compound statements.
- Files to be read using
INshould end with an extra
end;command. The reason for this is explained in the section on the
INcommand. This use of
ENDdoes not allow an immediately preceding
end(such as the
endof a procedure definition), so we advise using
R"bye" (or alternatively
R"quit") stops the execution of REDUCE, closes all open output files, and returns you to the calling program (usually the operating system). Your REDUCE session is normally destroyed.
R"showtime" prints the elapsed time since the last call of this command or, on its first call, since the current REDUCE session began. The time is normally given in milliseconds and gives the time as measured by a system clock. The operations covered by this measure are system dependent.
define allows a user to supply a new name for any identifier or replace it by any well-formed expression. Its argument is a list of expressions of the form
⟨identifier⟩ = ⟨number⟩∣⟨identifier⟩∣⟨operator⟩∣ ⟨reserved word⟩∣⟨expression⟩
be will be interpreted as an equal sign, and
x as the expression
y+z from then on. This renaming is done at parse time, and therefore takes precedence over any other replacement declared for the same identifier. It stays in effect until the end of the REDUCE run.
SYMBOLIC have properties which prevent
define from being used on them. To define
ALG to be a synonym for
ALGEBRAIC, use the more complicated construction