Professional Documents
Culture Documents
BSCS III
CS 311
Lisp Programming Language
LISP HISTORY
Lisp was invented by Artificial Intelligence (AI) pioneer John Mc Carthy in the late 1950s. It
was intended as a mathematical formalism for reasoning about the use of recursion equations as
a model for computation. Of computer languages still in widespread use today, only FORTRAN
is older. Over the past four decades Lisp was able to survive all sorts of technology fads, market
crises and economic recessions.
The Lisp family of languages has evolved with the field of computer science, both by putting the
best ideas from the field into practical use, and by contributing many such ideas. The association
of Lisp with research, however, has not always been beneficial. Lisp has always been among the
main tools of AI since the beginning. When the commercial AI market failed to deliver on its
promises, Lisp was blamed as a scapegoat. In the late 1980s, many companies abandoned Lisp in
favor of other languages, starting the so called "AI winter". Although Lisp survived the crisis,
some of the resulting prejudice and lack of information is still present in the computing field.
In the early 1980s there was a number of increasingly diverging Lisp dialects. The user
community started a major consolidation and standardization effort to design the Common Lisp
dialect as a general purpose, industrial strength programming language. This work continued
CS 311
Lisp Programming Language
under the auspices of ANSI. When Common Lisp was formally approved in 1994, it became the
first ANSI standard (X3.226-1994) to incorporate object-oriented programming.
Lisp is now a family of powerful and mature languages. Its user community leverages the
stability of Common Lisp to solve large, complex and challenging problems in industry and
research. But the future of Lisp is not locked: its nature allows it to adapt and evolve by both
creating layered standards for existing dialects such as Common Lisp, and creating completely
new designs.
Resources
The early development of Lisp is described by McCarthy in the 1978 paper History of Lisp (see
also his 1980 paper Lisp --- Notes on Its Past and Future), and the papers by Herbert Stoyan.
Two of the major developers of the language since then, Richard Gabriel and Guy L. Steele,
presented The Evolution of Lisp at the 1993 ACM History of Programming Languages
Conference.
AutoLisp
CS 311
Lisp Programming Language
Dylan
.
Emacs Lisp
.
Minor dialects
EuLisp
.
ISLISP
.
Small language for industrial needs. It is "culturally compatible" with Common Lisp
XLispStat
.
A reflective Lisp; the Lisp system was based on an infinite tower of Lisp interpreters
Flavors
.
CS 311
Lisp Programming Language
Franz Lisp
.
This was a Lisp for conventional architectures (VAX), and the product that launched Lisp
vendor Franz, Inc.
Interlisp
.
This dialect was derived from BBN Lisp and developed at Xerox. It was the base for
some early workstations. These systems had a nice comfortable user environment using
mouse and windows. The language lives on in Medley. It was also the base for
NoteCards, an early hypertext system. Commercialized as Medley.
Lisp 1.5
.
The first major Lisp dialect, developed by John McCarthy and his colleagues. For
reference see the book LISP 1.5 Programmer's Manual (MIT Press, 1962). Lisp 1.5
already featured a native code compiler.
LOOPS
.
MacLisp
.
MacLisp was developed at MIT and had much influence on the design of Common Lisp.
In particular, ZetaLisp and Scheme were descendent from it. The MAC in Maclisp had
nothing to do with the Apple Macintosh, which did not come onto the computer scene
until later. Rather, it referred to Project MAC, a research project at MIT which later
became known as the Laboratory for Computer Science. The acronym MAC stood for no
particular thing, but various meanings were attached, such as: "Men and Computers",
"Minds and Cognition", "Machine-Aided Cognition", etc. (The symbolic algebra program
CS 311
Lisp Programming Language
Macsyma was originally written at Project MAC in Maclisp, hence the MAC in its
name.)
XLisp
.
ZetaLisp
.
The implementation language for the Symbolics Lisp Machines. Has its roots in
MacLisp.
CS 311
Lisp Programming Language
4. A new concept of variables. In Lisp, all variables are effectively pointers. Values are what
have types, not variables, and assigning or binding variables means copying pointers, not
what they point to.
5. Garbage-collection.
6. Programs composed of expressions. Lisp programs are trees of expressions, each of
which returns a value. (In some Lisps expressions can return multiple values.) This is in
contrast to FORTRAN and most succeeding languages, which distinguish between
expressions and statements.
It was natural to have this distinction in FORTRAN because (not surprisingly in a
language where the input format was punched cards) the language was line-oriented. You
could not nest statements. And so while you needed expressions for math to work, there
was no point in making anything else return a value, because there could not be anything
waiting for it.
This limitation went away with the arrival of block-structured languages, but by then it
was too late. The distinction between expressions and statements was entrenched. It
spread from FORTRAN into Algol and thence to both their descendants.
When a language is made entirely of expressions, you can compose expressions however
you want. You can say either (using Arc syntax)
(if foo (= x 1) (= x 2))
7. A symbol type. Symbols differ from strings in that you can test equality by comparing a
pointer.
8. A notation for code using trees of symbols.
9. The whole language always available. There is no real distinction between read-time,
compile-time, and runtime. You can compile or run code while reading, read or run code
while compiling, and read or compile code at runtime.
Running code at read-time lets users reprogram Lisp's syntax; running code at compiletime is the basis of macros; compiling at runtime is the basis of Lisp's use as an extension
language in programs like Emacs; and reading at runtime enables programs to
communicate using s-expressions, an idea recently reinvented as XML.
CS 311
Lisp Programming Language
Though useful to present-day programmers, it's strange to describe Lisp in terms of its variation
from the random expedients other languages adopted. That was not, probably, how McCarthy
thought of it. Lisp wasn't designed to fix the mistakes in FORTRAN; it came about more as the
byproduct of an attempt to axiomatize computation.
The Common LISP environment follows the algorithm below when interacting with users:
loop
read in an expression from the console;
evaluate the expression;
print the result of evaluation to the console;
end loop.
Common LISP reads in an expression, evaluates it, and then prints out the result. For example, if
you want to compute the value of (2 * cos(0) * (4 + 6)), you type in:
USER(1): (* 2 (cos 0) (+ 4 6))
Before prompting you to enter the next expression, several things are worth
noting:
CS 311
Lisp Programming Language
LISP expressions are composed of forms. The most common LISP form is function
application. LISP represents a function call f(x) as (f x). For example, cos(0) is written
as (cos 0).
LISP expressions are case-insensitive. It makes no difference whether we type (cos 0)
.
.
or (COS 0).
Similarly, "+" is the name of the addition function that returns the sum of its arguments.
Some functions, like "+" and "*", could take an arbitrary number of arguments. In our
example, "*" took three arguments. It could as well take 2 arguments, as in "(* 2 3)", or
evaluates function calls in applicative order, which means that all the argument forms
are evaluated before the function is invoked. That is to say, the argument forms (cos 0)
and (+ 4 6) are respectively evaluated to the values 1 and 10 before they are passed as
arguments to the * function. Some other forms, like the conditionals, are not evaluated in
.
applicative order.
Numeric values like 4 and 6 are called self-evaluating forms: they evaluate to
themselves. To evaluate (+ 4 6) in applicative order, the forms 4 and 6 are
respectively evaluated to the values 4 and 6 before they are passed as arguments to the +
function.
Complex arithmetic expressions can be constructed from built-in functions like the following:
Numeric Functions
Meaning
(+ x1 x2 ... xn)
(* x1 x2 ... xn)
(- x y)
Subtract y from x
(/ x y)
Divide x by y
(rem x y)
(abs x)
CS 311
Lisp Programming Language
Common LISP has a rich set of pre-defined numerical functions. For a complete coverage,
consult Chapter 12 of the book, Common LISP, The Language (2nd Edition) (CLTL2) by
Guy Steele. Adventurous readers should consult CLTL2 frequently for more in-depth explanation
of various features of the language.