You are on page 1of 9

GAYONDATO, Austine Jessa G.

BSCS III

CS 311
Lisp Programming Language

THE EVOLUTION OF LISP


Lisp is the world's greatest programming language or so its proponents think. The structure of
Lisp makes it easy to extend the language or even to implement entirely new dialects without
starting from scratch. Overall, the evolution of Lisp has been guided more by institutional
rivalry, one-upsmanship, and the glee born of technical cleverness that is characteristic of the
"hacker culture" than by sober assessments of technical requirements.
Nevertheless this process has eventually produced both an industrial strength programming
language, messy but powerful, and a technically pure dialect, small but powerful, that is suitable
for use by programming-language theoreticians.

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

GAYONDATO, Austine Jessa G.


BSCS III

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.

THE LISP FAMILY OF LANGUAGES


Major languages in current use
Common Lisp

. General purpose, industrial strength language


Scheme
.

Educational and research language.

Major dialects in current use


Arc
.

New dialect for expert programmers

AutoLisp

GAYONDATO, Austine Jessa G.


BSCS III

CS 311
Lisp Programming Language

CAD program extension language

Dylan
.

Object-oriented language inspired by Common Lisp

Emacs Lisp
.

Text editor extension language

Minor dialects
EuLisp
.

European Lisp dialect


Interleaf
.

Typesetting and page layout program extension language

ISLISP
.

Small language for industrial needs. It is "culturally compatible" with Common Lisp

XLispStat
.

Dialect specialized for mathematical and statistical applications

Dialects of Historical Interest


3Lisp
.

A reflective Lisp; the Lisp system was based on an infinite tower of Lisp interpreters

Flavors
.

The object-oriented programming facility of Zetalisp; major differences from the


Common Lisp Object System (CLOS, the Common Lisp object-oriented facility) include
message passing rather than generic functions (more like Smalltalk), and a different
inheritance ordering protocol

GAYONDATO, Austine Jessa G.


BSCS III

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
.

The Lisp Object-Oriented Programming System developed at Xerox. A close precursor to


CLOS. A fairly portable version is called PCL.

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

GAYONDATO, Austine Jessa G.


BSCS III

CS 311
Lisp Programming Language

Macsyma was originally written at Project MAC in Maclisp, hence the MAC in its
name.)
XLisp
.

Precursor of AutoLisp and XLispStat.

ZetaLisp
.

The implementation language for the Symbolics Lisp Machines. Has its roots in
MacLisp.

WHAT MADE LISP DIFFERENT


In 1960, John McCarthy published a remarkable paper in which he did for programming
something like what Euclid did for geometry. He showed how, given a handful of simple
operators and a notation for functions, you can build a whole programming language. He called
this language Lisp, for "List Processing," because one of his key ideas was to use a simple data
structure called a list for both code and data.

Lisp embodied nine new ideas:


1. Conditionals. A conditional is an if-then-else construct. We take these for granted now.
They were invented by McCarthy in the course of developing Lisp. (FORTRAN at that
time only had a conditional goto, closely based on the branch instruction in the
underlying hardware.) McCarthy, who was on the Algol committee, got conditionals into
2.

Algol, hence they spread to most other languages.


A function type. In Lisp, functions are first class objects-- they're a data type just like
integers, strings, etc, and have a literal representation, can be stored in variables, can be

passed as arguments, and so on.


3. Recursion. Recursion existed as a mathematical concept before Lisp of course, but Lisp
was the first programming language to support it. (It's arguably implicit in making
functions first class objects.)

GAYONDATO, Austine Jessa G.


BSCS III

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))

or (= x (if foo 1 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.

GAYONDATO, Austine Jessa G.


BSCS III

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.

BASIC LISP PROGRAMMING


LISP Expressions
When you start up the Common LISP environment, you should see a prompt, which means that
LISP is waiting for you to enter a LISP expression. In the environment I am using, it looks like
the following:
USER(1):

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))

Common LISP replies:


20.0

Before prompting you to enter the next expression, several things are worth
noting:

GAYONDATO, Austine Jessa G.


BSCS III

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

4 arguments, as in "(* 2 3 4 5)".


In general, a function application form looks like (function argument1
argument2 ... argumentn). As

in many programming languages (e.g. C/C++), LISP

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)

The sum of x1, x2, ..., xn

(* x1 x2 ... xn)

The product of x1, x2, ..., xn

(- x y)

Subtract y from x

(/ x y)

Divide x by y

(rem x y)

The remainder of dividing x by y

(abs x)

The absolute value of x

(max x1 x2 ... xn)

The maximum of x1, x2, ..., xn

(min x1 x2 ... xn)

The minimum of x1, x2, ..., xn

GAYONDATO, Austine Jessa G.


BSCS III

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.

You might also like