A History Mechanism



next up previous
Next: An Example of Up: A Few Simple Previous: Making Your Own

A History Mechanism

Lisp-Stat uses the same history mechanism as Common Lisp. The symbols - + ++ +++ * ** *** have the following meaning:

-
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 ***

Thus

> (def x 1)
X
> (*)
1
> (/ * 10)
0.1
> (* * 10)
1.0
> (* ** 10)
1.0

Actually the first one is a trick. Notice that, for example, the symbol * can be both a function and a variable. If we ask for help about this symbol

> (help '*)
*                                                         [function-doc]
Args: (&rest numbers)
Returns the product of its arguments. With no args, returns 
1. Vectorized.
*                                                         [variable-doc]
The result of the last evaluation
we get both its definition as a function and its binding as a variable. And in this particular case * always returns 1 if it has no argument.




Tue Aug 29 09:10:30 MDT 1995