More on the XLISP-STAT Listener

Because of the large number of parentheses involved, Lisp expressions can be hard to read and type correctly. To make it easier to type readable, correct expressions the listener window on the Macintosh has the following features: These four features should make typing expressions correctly much easier. In particular, in translating mathematical formulas to Lisp it sometimes seems that you have to do things backwards. Using these features you can build up your expression from the inside out 12.

XLISP 2.0 provides a simple command history mechanism. The symbols -, *, **, ***, +, ++, and +++ are used for this purpose. The top level reader binds these symbols as follows:

- the current input expression
+ the last expression read
++ the previous value of +
+++ the previous value of ++
* the result of the last evaluation
** the previous value of *
*** the previous value of **

The variables *, ** and *** are probably most useful. For example, if you construct a plot but forget to assign the resulting plot object to a variable you can recover it using one of the history variables:

> (histogram (normal-rand 50))
#<Object: 3701682, prototype = HISTOGRAM-PROTO>
> (def w *)
W
> w
#<Object: 3701682, prototype = HISTOGRAM-PROTO>
>
The symbol W now has the histogram object as its value and can be used to modify the plot, as described in Section [*].

Like most interactive systems, XLISP needs a system for dynamically managing memory. The system used by XLISP is to grab memory out of a fixed bin until the bin is exhausted. At that point the system pauses to reclaim memory that is no longer being used. This process, called garbage collection, will occasionally cause the system to freeze up for about a second. When the system garbage collects the Macintosh cursor changes to a trash bag.

Occasionally a calculation will take too long, or it will appear to have gotten stuck in some kind of loop. If you want to interrupt the calculation hold down the COMMAND key and the PERIOD. This should return you to the listener. You must continue to hold down the key until the calculation stops.