[cl-faq] Where is my compiler?

Brad Beveridge brad.beveridge at gmail.com
Thu Dec 15 15:17:50 CST 2005


The FAQ question is:
Q: Where is my compiler?  My debugger?  Where is my program running?

3 months into using CL I am still getting my head around the whole
idea of a Lisp image, and that some forms ought to be active at
different times.  I'll write a bit about what I think the Lisp image
concept is all about.

A: Lisp works quite differently to most languages that you may be
familiar with, for example C has a very distinct cycle.  You edit some
code, compile it with a seperate compiler and produce an executable. 
You can then run that executable, perhaps with a debugger attached to
it.  Modern IDEs smooth the distinctions between these steps, but
under the hood they are still there.
With Lisp, you have a Lisp image - the compiler, interpreter, debugger
and your application all run within the same image.  This is quite a
profound difference, for example it means that your application
automatically has a built in compiler!  There are many different
implementations of Lisp, and what is available in your image may very
- for example some Lisps have no interpreter part & some only have a
compiler.

I have started thinking of my Lisp image as its own environment,
almost a seperate little operating system.

Interacting with the Lisp image is done via the Read-Eval-Print-Loop
(REPL), which as the name implies, reads input, evaluates and then
prints it.  You can send forms to the REPL and immediately get back
the results of executing that form, this is a great way to test out
the nuts and bolts of a function as you are writing it.

When you write a function by using (defun), you are altering the state
of the Lisp image - there is now a new function that can be used
within the running image.

That is about all I can think of, but there could be a very big
article on how to think about the Lisp image concept.

Cheers
Brad


More information about the cl-faq mailing list