Introduction to ALLEGRO Common Lisp

1. Run ALLEGRO CL(Common Lisp)

You can easily run ALLEGRO CL with your windows program menu.

Figure 1. windows program menu

2. How To Use ALLEGRO Common Lisp

After running the ALLEGRO CL, you can type in any valid lisp expression.

Figure 2. ALLEGRO CL windows

Probably, the most familiar and easy functions are the arithmetic functions of addition, subtraction, multiplication, and division. All of these functions are usable in pre-order form. Here are a few examples, as depicted in figure 3.

Figure 3. Simple expression

3. Simple Lisp Function

Suppose we type the following Lisp function and save the function in the file

"sample.lisp":

> (defun simple (x)

(* x (- x 1)))

We can now load the file "sample.lisp" into the Lisp environment. To load a file, use the load icon under the menu bar.

4. Capturing the Output : dribble

While you're in Lisp, you can use the dribble function to capture the output to a file. The dribble function takes a file name, in double quotes, as the argument. To close the dribble file, enter (dribble) at the prompt. Everything typed by you and printed by Lisp will be stored in the file until you close the output file.

>(dribble "sample.drib")

>(simple 2)

2

>(dribble)

5. Debug Mode

At times, you may enter an invalid Lisp expression or run a program which the Lisp interpreter cannot understand. When this happens, the Lisp interpreter will give you an error message and transfer you to "debug" mode, as in the following example.

>(add 1 2)

Figure 5. Error window

Because you didn't define the add function, the interpreter can't process the command. So Error window appears. At this point you can get into the debugger window to know what was wrong in detail.

Figure 6. debugger window