7 The Listener

7.2 Evaluating simple forms

1. Type the number12 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; Section 7.10 on page 78 describes how to move the cursor to different places, and thus you may not always be on the current prompt.

Any Common Lisp form typed at the prompt is evaluated and its results printed immediately below in the listener.

Common Lisp evaluates this input and prints the result of that evaluation. When Common Lisp evaluates a number, the result is the number itself, and so12 is printed out:



When results are printed in the listener, they start on the line following the last line of input. The12 has been printed immediately below the first prompt, and below that, another prompt has been printed.

2. Type* at the current prompt.



* 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 ANSI standard for Common Lisp (ANSI X3.226:1994).

3. Type(setq val 12) at the current prompt.

PROMPT > (setq val 12)


The expression sets the variableval to12. The result of evaluating the form is the value to whichval has been set, and thus the listener prints12 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 the environment has been told to "remember" that12 is associated withval.

4. Typeval.

The form is evaluated and12 is printed below it.

5. Type(+ val val val).

The form, which computes the sum of threevals, is evaluated, and36 is printed below it.

Common LispWorks User Guide, Liquid Common Lisp Version 5.0 - 18 OCT 1996

Generated with Harlequin WebMaker