Lisp

term

programming

Kept in this browser · My desk

John McCarthy's language of 1958 to 1960 at Massachusetts Institute of Technology (MIT), "LISP (for LISt Processor)", built on lists, recursion and functions as values.

Implementation began in Fall 1958; McCarthy's 1960 paper in the Communications of the Association for Computing Machinery (ACM) defined it, and S. R. Russell turned its eval function into the first Lisp interpreter.

What it is. Lisp is the language John McCarthy designed from 1958 to 1960 at the Massachusetts Institute of Technology (MIT), "LISP (for LISt Processor)" in his 1960 paper, built on lists, recursion and functions as values. The Common Lisp standard's own history places its seeds earlier: "Early key ideas in Lisp were developed by John McCarthy during the 1956 Dartmouth Summer Research Project on Artificial Intelligence", his motivation being "an algebraic list processing language for artificial intelligence work".

Before Lisp. McCarthy's History of Lisp, written in 1979, describes the prehistory. Herbert Gelernter and Carl Gerberich at IBM built FLPL, the FORTRAN List Processing Language, and noticed that cons should be a function returning the location of a new word. Writing FORTRAN programs, McCarthy invented a function XIF(M, N1, N2) to choose a value, but since FORTRAN evaluated all three arguments first it had to be used sparingly; that led to the conditional expression, which Lisp made ordinary.

Names from the hardware. Lisp's best-known names come from the IBM 704. A list cell's two halves sat in the address and decrement parts of a machine word, so McCarthy defined car, "Contents of the Address part of Register number", and cdr for the decrement part; "the vulgar fact that the IBM 704 had instructions (connected with indexing) that made these operations easy to implement" strengthened the choice. Implementation began in Fall 1958.

Garbage collection. Lisp needed a way to reclaim list cells nobody used. Reference counts seemed infeasible "since there were only six bits left in a word"; the alternative was garbage collection, "in which storage is abandoned until the free storage list is exhausted, the storage accessible from program variables and the stack is marked, and the unmarked storage is made into a new free storage list". Every garbage-collected language since, from Java to Python, inherits the idea.

The interpreter by accident. McCarthy's 1960 paper in the Communications of the Association for Computing Machinery (ACM) defined the language with a universal function, eval; S. R. Russell "noticed that eval could serve as an interpreter for LISP, promptly hand coded it". McCarthy later regretted that the unexpected interpreter froze some light decisions: the COND notation "which leads to an unnecessary depth of parentheses", and "the use of the number zero to denote the empty list NIL and the truth value false", which "has caused difficulties in all subsequent implementations". The LISP 1.5 Programmer's Manual of 17 August 1962, from the MIT Computation Center and Research Laboratory of Electronics, documented the dialect that, according to the Common Lisp standard, was "the primary dialect of Lisp between 1960 and 1965"; its preface credits the manual to Michael I. Levin, the interpreter to Stephen B. Russell and Daniel J. Edwards, the garbage collector to Edwards, and the compiler and assembler to Timothy P. Hart and Levin.

Dialects and standards. By the early 1970s two dialects led, MacLisp and Interlisp. The Digital Equipment Corporation PDP-6 and PDP-10 suited Lisp because their 36-bit words and 18-bit addresses held a cons cell in one word, but the 18-bit address space (262,144 words) limited programs, which led to special Lisp machines and to Lisp on larger computers. In April 1981, after a meeting sponsored by the Defense Advanced Research Projects Agency (DARPA) about the "splintered Lisp community", several projects joined to define Common Lisp, and in 1986 the X3J13 committee was formed to produce an American National Standards Institute (ANSI) standard. Scheme, which the Revised7 Report of 2013 describes as "a statically scoped and properly tail recursive dialect of the Lisp programming language invented by Guy Lewis Steele Jr. and Gerald Jay Sussman", was first described in 1975 and requires implementations to support "an unbounded number of active tail calls".

What it gave and what goes wrong. Lisp made the conditional expression and recursion ordinary, represented programs as data so that a program can build and run programs, gave macros their power and gave the world garbage collection; Scheme in turn shaped JavaScript's functions. John Aycock even suspects McCarthy's 1960 paper of being the first published mention of just-in-time compilation. The same power is the risk: evaluating data as code is injection if the data comes from outside, and macros that rewrite programs can hide what the code really does. The parentheses, McCarthy's own complaint, remain the first obstacle for newcomers.

Neighbours. Lisp's neighbours are the interpreter it produced by accident, the functional paradigm it started, ML, which grew from the same theorem-proving world, and JavaScript, which inherited Scheme's functions. Brazilian practice says Lisp.

Also known as: LISP, list processor, common lisp, scheme

Sources

← Back to L Back to the glossary