7 The Listener

7.3 Re-evaluating forms

If you changeval to some other number, and want to know the sum of threevals again, you can avoid re-typing the form which computes it. To see how this is done, follow the instructions below.

1. Type(setq val 1).

The variableval is now set to 1.

2. PressMeta-P.

PROMPT > (setq val 1)

The form you previously typed appears at the prompt. At this point, you could edit this form and press Return to evaluate the edited form. For the moment, just carry on with the next instruction.

3. PressMeta-P again, and then press Return.

PROMPT > (+ val val val)


PressingMeta-P a second time displayed the second to last form that you evaluated. This time, pressing Return immediately afterwards simply re-evaluates the form. Note that you could have edited the recalled form before evaluating it. You can useMeta-P repeatedly, recalling any form that you have evaluated in the current session.

This time the form evaluates to the number3, becauseval changed in the interim.

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

Generated with Harlequin WebMaker