REDUCE

13.1 Referencing Previous Results

It is often useful to be able to reference results of previous computations during a REDUCE session. For this purpose, REDUCE maintains a history of all interactive inputs and the results of all interactive computations during a given session. These results are referenced by the command number that REDUCE prints automatically in interactive mode. To use an input expression in a new computation, one writes input(n), where n is the command number. To use an output expression, one writes WS(n). WS references the previous command. E.g., if command number 1 was INT(X-1,X); and the result of command number 7 was X-1, then

        2*input(1)-ws(7)^2;

would give the result -1, whereas

        2*ws(1)-ws(7)^2;

would yield the same result, but without a recomputation of the integral.

The operator DISPLAY is available to display previous inputs. If its argument is a positive integer, n say, then the previous n inputs are displayed. If its argument is ALL (or in fact any non-numerical expression), then all previous inputs are displayed.