This is the Lisp Introduction Page. Refer to
various Lisp materials online through the calendar page, or
at the links below:
Lisp is a full-featured programming language that has traditionally supported
AI applications. In fact, AI courses are often taught using Lisp,
although this is done less often now (too difficult to teach enough
Lisp to be useful). Lisp is the oldest programming language still actively used.
Some Lisp systems come with a complete development environment, and Lisp has
been used for large software projects (such as Macsyma) and as the basis
for software engineering. Lisp appears simple, but this is deceptive.
Lisp is an interpreted language, and as such it has flexibility and power
not available to traditional compiled languages such as C, C++, or Java.
In Lisp more decisions are made at run-time.
In exchange for this flexibility and power, Lisp execution has always been
much slower than the traditional languages. Modern Lisp systems have
a compiler that improves performance considerably, though not to the level
of traditional languages.
Lisp presents editing problems, particularly the large number of
parentheses. Special lisp editors (or EMACS configured for Lisp)
can help a lot, but we'll be doing small enough programs that we
can ignore this. If you can, you should use an editor that
matches parentheses for you.
The Lisp We Will Use:
In this course, we will mostly study a subset that can be called
"pure Lisp", just the basics. Lisp has the equivalent of ordinary
loops, but you will not be allowed to use such loops in this course,
because I want you to study recursion and a "functional programming
style." This means in part the use of parameters, functions, and
recursion, without using assignments or loops. We will only be
using assignments (the function setq) at the top level.
A dialect of Lisp called Scheme is often used in courses,
but you are not to use it in this course. Scheme is a "stripped
down" and "cleaned up" small version of Lisp. However, Scheme has
a number of significant differences from Common Lisp.
So-called Common Lisp was created to combine most of the
features in use by the various Lisp dialects.
Common Lisp has a very large number of features, including
many alternative ways to do the same thing.
Common Lisp even includes classes and object-oriented programming.
In this course we will use Common Lisp, but restricted to
a small collection of permitted features. I expect you
to use the notation and functions presented here, and not the
various alternatives. (This is partly to force you to write
the functions yourself, rather than finding them online.)
Several faculty members know Lisp better than I do, but
you are not to ask them to help you with assignments and other
Lisp, Access and References:
- Accessing Lisp:
- Right now at UTSA Lisp is only available on the machine
elk01. (Maybe other elks later.) To access this Lisp, you
first must ssh to elk01.
This is Common Lisp, available as gnu clisp, using
% /usr/bin/clisp or just % clisp, where '%' is the
- On my Linux at home it took me 5 minutes to download this.
- The first link that came up under google for PC Lisp was:
Download. (I haven't tried this.)
- Exiting Lisp:
- Use (exit) or
(quit) (parentheses required -- just
exit or quit is an error)
- Ctrl-D works also, but not in error mode.
- Lisp is NOT case sensitive: Normally input is in lower-case,
but it doesn't have to be. The output is always upper-case, except
of course for quoted material.
- Lisp references: Here are some online references
to use along with class notes.
But beware! The references contain far too much material.
- Online tutorials (the two below seem good,
but the one in red
is probably your best choice):
Lisp Primer, by Colin Allen and Maneesh Dhagat:
- Successful Lisp:
How to Understand and Use Common Lisp, by David Lamkins:
- "Elementary" lisp books:
- Common Lisp,by David Touretzky: (.pdf)
[1 MB]. (This is OK, but uses weird non-standard diagrams.)
- Basic Lisp Techniques, by David Cooper: (.pdf) [404 KB]. (This book is harder.)
- Lisp references (insanely complex and incomprehensible):
- Pocket guide:
(I include this to show how crazy these Lisp people are.)
- 1100 page lisp reference manual:
(.pdf) (3.9 meg).
This is Common Lisp the Language by
Guy L. Steele, Second Edition, 1990, 1072 + xxvii pages.
(I include this to show how large and complex Common Lisp is.)
- Official standard, the "Common Lisp HyperSpec":
(.html) (Makes the other crazy references above seem sane.)
- Clisp implementation notes:
(Some very useful material.)
Lisp behaves in ways similar to some
of the "scripting" languages and others. When you type
the command "clisp", the Lisp interpreter gives you a
prompt and processes further commands, one after the other.
As with some scripting languages, Lisp does not require a
declaration for a variable, and a given variable can be used
for different data types in the same program.
Here is a sample Lisp session, where material in
(with comments in orange) is
what you type in. The rest is what the system responds with.
The system puts in bracketed input line numbers, but I'm usually
going to leave them off in examples, because I want to cut and paste
and edit these examples.