[version française]

What is Lisp?

Lisp is a functional programming language, or rather a family of functional programming languages, which is high-level (granted you have a good definition of "high level"; let's say you don't explicitely manipulate pointers, and you don't have to take care of memory allocation manually, for instance), general-purpose (it's been successfully used in artificial intelligence, operating system design, symbolic computation, editors, graphical user interfaces, compilers for languages other than Lisp, and about any other use of programming languages). It features some peculiarities, such as a unique representation for code and data; i.e., any syntactically valid Lisp code is a syntactically valid piece of Lisp data, that can be manipulated like any data, and vice-versa. One can operate on pieces of code through the use of macros which are basically functions that take code as arguments.
Any Lisp dialect has the two primitives read and eval which respectively parse and evaluate a Lisp form.

A short history of Lisp

Lisp was invented (or rather, as himself likes to say, discovered) by John McCarthy, a mathematician and MIT professor, between 1956 and 1958. He was looking for a language suited to symbolic and formal manipulation. Originally, it wasn't meant to be implemented, but rather to be used as a theoretical tool. However, Steve Russell, one of his students, noticed that implementing eval was enough to get a Lisp interpreter, which he did on the AI Lab IBM 709 mainframe, in 1959.
That's how Lisp began. As it was particularly well suited to complex problems, Lisp developed quite quickly, and was the main language used by the A.I. Lab hackers, alongside assembler.
However, the lack of memory and power in computers of that time made Lisp unconvenient to use for some tasks (the need for garbage collection, in particular, made its use for a PDP-10 operating system impossible). Therefore came the idea to design a specific architecture, optimized to run Lisp program, and in 1974, Richard Greenblatt, Tom Knight and others started working on the first Lisp Machine, CONS.

Various dialects

One of Lisp's peculiarities (which is due to its history, and not at all a designed feature), is the existence of various dialects, which were quite numerous before the standardization of Common Lisp (a process begun in 1984).

First was implemented LISP, as mentioned before. This first version was supposed to use M-expressions (expressions that resemble mathematical formulaes, such as 3 * (foo(2,3) + 2)). Its implementation was done with S-expressions (basically syntactic trees, such as (* 3 (+ (foo 2 3) 2))), which are easier to manipulate. LISP 1.5 (whose manual, written by John McCarthy, came out in 1962; I have an original hardcopy at home :-)) marks the beginning of an era where Lisp was very much used among computer scientists. It was implemented on the PDP-1 by L. Peter Deutsch (who later wrote Ghostscript, among other software). At Project MAC at MIT was designed MACLisp, which probably was the dialect in which most lines of code were written before the advent of Lisp Machines. ZetaLisp and Lisp Machine Lisp were used on Lisp Machines, among other dialects.
In 1975 was created Scheme, the first Lisp whose variables were always lexically scoped. In previous dialects such as MACLisp, the interpreter used dynamic scoping, and the compiler used lexical scoping, due to a mistake in the original implementation. Thus, what John McCarthy called "a historical mistake" is not the deliberate choice to use dynamic scoping, but the implementation misfeature that made it happen (it is also true that dynamic scoping is easier to implement).
One can also mention the respectively french and european LeLisp and EULisp dialects. Finally, Common Lisp is the result of a long unification process between the numerous dialects. This language has a 1994 ANSI standard. It was greatly influenced by MACLisp and Lisp Machine Lisp, which is not surprising considering the standard commitee was composed of many long time Lisp machine hackers. It is a large language, that has many standard features (many algorithmical structures and arbitrary-big integers, for example), contrary to Scheme, whose standard is voluntarily kept minimal, to keep the language very clean so its pedagogical value is retained.
Common Lisp is lexically scoped. I also want to make clear, in order to break a quite persistent myth, that Common Lisp has a static type system; more precisely, if one doesn't give any type indications, the compiler will type at runtime whatever objects it could not type during compilation. One can nonetheless give type indications, and a good compiler will infer as much as possible the type of the other objects using these indications. This allows to maintain the flexibility of a dynamically typed language, without the necessary expressiveness limitations of a fully static type-system, while still offering the security and efficiency of static typing (since whatever objects typed at compile-time will not need their type to be determined again at runtime). Thus, the static type system is viewed as an optimization rather than an intrinsic feature of the language.

Want to know more?

If this short introduction has aroused your interest (which I hope), here are a few pointers to resources to learn Common Lisp. There are many others, but I'd rather only list those I can give my opinion about.


Valid XHTML 1.0! Viewable With Any Browser Powered by GNU Emacs