12
at the prompt, and press Return
.
In general, assume that you should press Return
after typing something at the prompt, and that you should type at the
current prompt
(that is, the one at the bottom of the screen). In fact, the latter is not always necessary; Execute mode describes how to move the cursor to different places, and thus you may not always be on the current prompt.
Any Common Lisp form entered at the prompt is evaluated and its results are printed immediately below in the Listener.
When Common Lisp evaluates a number, the result is the number itself, and so 12
is printed out:
PROMPT > 12
12
PROMPT >
When results are printed in the Listener, they start on the line following the last line of input. The 12
has been printed immediately below the first prompt, and below that, another prompt has been printed.
*
at the current prompt.PROMPT > *
12
PROMPT >
The variable *
always has as its value the result of the previous expression; in this case, 12
, which was the result of the expression typed at the first prompt. For a full description, see the Common Lisp HyperSpec. This is an HTML version of the ANSI Common Lisp standard which is supplied with LispWorks.
(setq val 12)
at the current prompt.PROMPT > (setq val 12)
12
PROMPT >
The expression sets the variable val
to 12
. The result of evaluating the form is the value to which val
has been set, and thus the Listener prints 12
below the form typed at the prompt.
This is exactly the same behavior as before, when you typed a number it was evaluated and the result printed in the Listener. What is different this time, of course, is that Lisp has been told to "remember" that 12
is associated with val
.
val
.
The form is evaluated and 12
is printed below it.
(+ val val val)
.
The form, which computes the sum of three val
s, is evaluated, and 36
is printed below it.
LispWorks IDE User Guide (Macintosh version) - 12 Feb 2015