NextPrevUpTopContentsIndex

2.2 Creating a Listener

The Listener tool interactively evaluates the Lisp forms you enter. 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 evaluate another piece of. The structure of this tutorial reflects this two-stage approach.

Except on Unix platforms, a Listener is created when you start the Common LispWorks environment. If you don't currently have a Listener (check the Windows menu), start one by choosing Tools > Listener or clicking on in the Podium. This section of the tutorial demonstrates some of its more useful features. A Listener window is shown in Listener below.

Figure 2.2 Listener

The Listener contains two views: the Listener view and the output view. At the bottom of the Listener is an echo area that is visible in either view. The echo area is used to prompt you for information when performing editor commands such as searching for text. You can switch between the two views by clicking the Listener and Output tabs respectively. You can evaluate Lisp forms in the Listener view by typing the form, followed by Return. Any output that is produced is displayed in the Listener view.

  1. Type the following form into the Listener and press Return .
  2. (+ 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. Press Meta+P .
  4. 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.

  5. Press Ctrl+B to move the cursor back one space. Now press the Backspace key to delete the number 2 , and type 3 in its place.
  6. You have edited the form (+ 1 2) to create a new form, (+ 1 3) .

  7. 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 (Windows version) - 5 Jul 2006

NextPrevUpTopContentsIndex