2 A Short Tutorial

2.2 Creating a listener

The listener is a tool that interactively evaluates any Common Lisp forms you type into it. During a typical session, you evaluate pieces of code in the listener, then examine the effects in other tools, returning to the listener whenever you want to make more changes. The structure of this tutorial reflects this two-stage approach.

This section of the tutorial shows you how to create a listener, and demonstrates some of its more useful features.

1. Choose Tools > Listener from the podium window.

A listener appears on your screen, as shown in Figure 2.2 below.

Figure 2.2 Listener

To evaluate a Common Lisp form, make sure the listener has the mouse focus (either by moving the mouse pointer over the listener, or by selecting the listener with the mouse) and type the form, followed by Return.

2. Type the following form into the listener and press Return.

(+ 1 2)

The result of the evaluation, 3, appears in the listener, and a new prompt is printed. Notice that the number in the prompt has been incremented, indicating that a form has been evaluated.

Because you may want to enter a number of very similar forms, commands are provided which make this easy.

3. PressMeta-P.

The form that you just evaluated is printed at the new prompt. You can press Return to evaluate this form again, or, more usefully, you can edit the form slightly before evaluating it.

4. PressCtrl-B to move the cursor back one space. Now press the Backspace key to delete the number2, and type3 in its place.

You have edited the form(+ 1 2) to create a new form,(+ 1 3).

5. Press Return to evaluate the new form.

The result of the evaluation, 4, appears in the listener, followed by another new prompt, with the prompt number incremented once again.

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

Generated with Harlequin WebMaker