Next: , Previous: , Up: First steps   [Contents][Index]

3.4 Common Lisp environment

First, it is of uttermost importance that you use an editor which "understands" Lisp code and can indent it correctly, show matching parentheses or do suitable syntax-highlighting. Otherwise, it is almost impossible to write nontrivial Lisp code. On the other hand, if such an editor is available, it will often provide commands for moving through the code and manipulating the code expression-wise, which makes writing Lisp even easier than writing, say, C. It is very useful to learn these editor features.

Furthermore, in contrast to most other languages, the ANSI Common Lisp standard defines an interface for introspection. E.g., functions and special variables can be documented, and these so-called docstrings can be extracted at any time. For example:

(defvar *result*
  "This special variable is often used for storing the result of the
  last top-level computation.")

Now, (documentation '*result* 'variable) returns the docstring provided before. If you use a decent Lisp environment, this command can be invoked by pressing some key when the cursor is on the symbol *result*.

The ANSI Common Lisp standard requires also an interface for tracing, inspecting data, together with some debugging commands. However, implementations vary in the quality of the provided tools. Commercial Lisps as Allegro CL, Lispworks or Corman CL provide very elaborate IDEs which allow for easy access to the above-mentioned features. A free alternative is the editor Emacs together with the SLIME package. Emacs/SLIME can handle a large range of Lisp implementations and provides more or less the same possibilities as the commercial IDEs.

Next: , Previous: , Up: First steps   [Contents][Index]