1. What is a "Lisp Machine" (LISPM)?

A Lisp machine (or LISPM) is a computer which has been optimized to run lisp
efficiently and provide a good environment for programming in it. The
original Lisp machines were implemented at MIT, with spinoffs as LMI (defunct)
and Symbolics (bankrupt). Xerox also had a series of Lisp machines
(Dandylion, Dandytiger), as did Texas Instruments (TI Explorer). The
TI and Symbolics Lisp machines are currently available as cards that
fit into Macintosh computers (the so-called "Lisp on a chip").

Optimizations typical of Lisp machines include:

- Hardware Type Checking. Special type bits let the type be checked
efficiently at run-time.

- Hardware Garbage Collection.

- Fast Function Calls.

- Efficient Representation of Lists.

- System Software and Integrated Programming Environments.

For further information, see:

Paul Graham, "Anatomy of a Lisp Machine", AI Expert, December 1988.

Pleszkun and Thazhuthaveetil, "The Architecture of Lisp Machines",
IEEE Computer, March 1987.

Ditzel, Schuler and Thomas, "A Lisp Machine Profile: Symbolics 3650",
AI Expert, January 1987.

Peter M. Kogge, "The Architecture of Symbolic Computers",
McGraw-Hill 1991. ISBN 0-07-035596-7.

2. How to call non-Lisp functions from Lisp?

Most Lisp implementations for systems where Lisp is not the most common
language provide a "foreign function" interface. As of now there has been
no significant standardization effort in this area. They tend to be
similar, but there are enough differences that it would be inappropriate to
try to describe them all here. In general, one uses an
implementation-dependent macro that defines a Lisp function, but instead of
supplying a body for the function, one supplies the name of a function written
in another language; the argument list portion of the definition is
generally augmented with the data types the foreign function expects and
the data type of the foreign function's return value, and the Lisp
interface function arranges to do any necessary conversions. There is also
generally a function to "load" an object file or library compiled in a
foreign language, which dynamically links the functions in the file being
loaded into the address space of the Lisp process, and connects the
interface functions to the corresponding foreign functions.

If you need to do this, see the manual for your language implementation for
full details. In particular, be on the lookout for restrictions on the
data types that may be passed. You may also need to know details about the
linkage conventions that are used on your system; for instance, many C
implementations prepend an underscore onto the names of C functions when
generating the assembler output (this allows them to use names without
initial underscores internally as labels without worrying about conflicts),
and the foreign function interface may require you to specify this form
explicitly.

Franz Allegro Common Lisp's "Foreign Function Call Facility" is
described in chapter 10 of the documentation. Calling Lisp Functions
from C is treated in section 10.8.2. The foreign function interface in
Macintosh Common Lisp is similar. The foreign function interface for
KCL is described in chapter 10 of the KCL Report. The foreign function
interfaces for Lucid on the Vax and Lucid on the Sun4 are
incompatible. Lucid's interface is described in chapter 5 of the
Advanced User's Guide.

3. How to learn about implementing Lisp interpreters and compilers?

Books about Lisp implementation include:

1. John Allen
"Anatomy of Lisp"
McGraw-Hill, 1978. 446 pages. ISBN 0-07-001115-X
Discusses some of the fundamental issues involved in
the implemention of Lisp.

2. Samuel Kamin
"Programming Languages, An Interpreter-Based Approach"
Addison-Wesley, Reading, Mass., 1990. ISBN 0-201-06824-9
Includes sources to several interpreters for Lisp-like languages.
The source for the interpreters in the book is available
by anonymous FTP from
a.cs.uiuc.edu:/pub/kamin/kamin.distr/
Tim Budd reimplemented the interpreters in C++, and has made
them available by anonymous ftp from
cs.orst.edu:/pub/budd/kamin/

3. Sharam Hekmatpour
"Lisp: A Portable Implementation"
Prentice Hall, 1985. ISBN 0-13-537490-X.
Describes a portable implementation of a small dynamic
Lisp interpreter (including C source code).

4. Peter Henderson
"Functional Programming: Application and Implementation"
Prentice-Hall (Englewood Cliffs, NJ), 1980. 355 pages.

5. Peter M. Kogge
"The Architecture of Symbolic Computers"
McGraw-Hill, 1991. ISBN 0-07-035596-7.
Includes sections on memory management, the SECD and
Warren Abstract Machines, and overviews of the various
Lisp Machine architectures.

6. Daniel P. Friedman, Mitchell Wand, and Christopher T. Haynes
"Essentials of Programming Languages"
MIT Press, 1992, 536 pages. ISBN 0-262-06145-7.
Teaches fundamental concepts of programming language
design by using small interpreters as examples. Covers
most of the features of Scheme. Includes a discussion
of parameter passing techniques, object oriented languages,
and techniques for transforming interpreters to allow
their implementation in terms of any low-level language.
Also discusses scanners, parsers, and the derivation of
a compiler and virtual machine from an interpreter.
Includes a few chapters on converting code into a
continuation passing style.
Source files available by anonymous ftp from
cs.indiana.edu:/pub/eopl/ [129.79.254.191].

7. Peter Lee, editor, "Topics in Advanced Language Implementation",
The MIT Press, Cambridge, Mass., 1991.
Articles relevant to the implementation of functional
programming languages.

8. Also see the proceedings of the biannual ACM Lisp and Functional
Programming conferences, the implementation notes for CMU Common Lisp,
Norvig's book, and SICP (Abelson & Sussman).

9. Christian Queinnec
"Les Langages Lisp"
InterEditions (in French), 1994. 500 pages.
ISBN 2-7296-0549-5, 61-2448-1. (?)
Cambridge University Press (in English), 1996.
ISBN 0-521-56247-3.

The book covers Lisp, Scheme and other related dialects,
their interpretation, semantics and compilation.

4. How to save programs to files?

files are standard LISP code that will run on any AutoCAD system.

5. Lisp books, introductions, documentation, periodicals, journals, and conference proceedings!

There are several good Lisp introductions and tutorials:

1. David S. Touretzky
"Common Lisp: A Gentle Introduction to Symbolic Computation"
Benjamin/Cummings Publishers, Redwood City, CA, 1990. 592 pages.
ISBN 0-8053-0492-4 ($42.95).
Perhaps the best tutorial introduction to the language. It has
clear and correct explanations, and covers some fairly advanced
topics. The book is an updated Common Lisp version of the 1984
edition published by Harper and Row Publishers.

Three free Lisp educational tools which were used in the book --
Evaltrace, DTRACE and SDRAW -- are available by anonymous ftp from
b.gp.cs.cmu.edu:/usr/dst/public/lisp/
b.gp.cs.cmu.edu:/usr/dst/public/evaltrace/
Evaltrace is a graphical notation for explaining how evaluation
works and is described in "Visualizing Evaluation in
Applicative Languages" by David S. Touretzky and Peter Lee,
CACM 45-59, October 1992. DTRACE is a "detailed trace" which
provides more information than the tracing tools provided with
most Common Lisp implementations. SDRAW is a read-eval-draw
loop that evaluates Lisp expressions and draws the result as a
cons cell diagram (for both X11 and ascii terminals). Also
available is PPMX, a tool for pretty printing macro expansions.

2. Robert Wilensky.
"Common LISPcraft"
W. W. Norton, New York, 1986. 500 pages. ISBN 0-393-95544-3.

3. Wade L. Hennessey.
"Common Lisp"
McGraw-Hill, New York, 1989. 395 pages. ISBN 0-07-028177-7, $26.95.
Fairly good, but jumps back and forth from the simple to the
complex rather quickly, with no clear progression in difficulty.

4. Laurent Siklossy.
"Let's Talk LISP"
Prentice-Hall, NJ, 1976. 237 pages, ISBN 0-13-53276-2-8.
Good introduction, but quite out of date.

5. Stuart C. Shapiro.
"Common Lisp: An Interactive Approach"
Computer Science Press/W.H. Freeman, New York, 1992.
358 pages, ISBN 0-7167-8218-9.
The errata for the book may be obtained by anonymous ftp from
ftp.cs.buffalo.edu:/users/shapiro/clerrata.ps

Other introductions to Lisp include:

1. A. A. Berk.
"LISP, The Language of Artificial Intelligence"
Van Nostrand Reinhold, 1985. 160 pages, ISBN 0-44-22097-4-6.

2. Paul Y. Gloess.
"An Alfred handy guide to Understanding LISP"
Alfred Publishers (Sherman Oaks, CA), 1982.
64 pages, ISBN 0-88-28421-9-6, $2.95.

3. Ward D. Maurer.
"The Programmer's Introduction to LISP"
American Elsevier, New York, 1972. 112 pages, ISBN 0-44-41957-2-6.

4. Hank Bromley and Richard Lamson.
"LISP Lore: A Guide to Programming the LISP Machine", 2nd edition
Kluwer Academic, Boston, 1987. 337 pages, ISBN 0-89-83822-8-9, $49.95.

5. Sharam Hekmatpour.
"Introduction to LISP and Symbol Manipulation"
Prentice Hall, New York, 1989. 303 pages, ISBN 0-13-53749-0-1, $40.

6. Deborah G. Tatar
"A programmer's guide to Common Lisp"
Digital Press, 1987. 327 pages. ISBN 0-932376-87-8.
Good introduction on Common Lisp for programmers familiar
with other programming languages, such as FORTRAN, PASCAL, or C.

7. Timothy Koschmann
"The Common Lisp Companion"
John Wiley & Sons, 1990. 459 pages, ISBN 0-471-503-8-8.
Targeted for those with some programming experience who wish to
learn draft-ANSI Common Lisp, including CLOS and the CL condition
system. Examples progress incrementally from simple numerical
calculation all the way to a logic-programming extension to CL.

More advanced introductions to Lisp and its use in Artificial
Intelligence include:

1. Peter Norvig.
"Paradigms of AI Programming: Case Studies in Common Lisp"
Morgan Kaufmann, 1992. 946 pages. ISBN 1-55860-191-0 ($49.95).

Provides an in-depth exposition of advanced AI programming techniques
and includes large-scale detailed examples. The book is the most
advanced AI/Common-Lisp programming text and reference currently
available, and hence is not for the complete novice. It focuses on the
programming techniques necessary for building large AI systems,
including object-oriented programming, and has a strong performance
orientation.

The text is marked by its use of "non-toy" examples to illustrate the
techniques. All of the examples are written in Common Lisp, and copies
of the source code are available by anonymous ftp from
unix.sri.com:/pub/norvig and on disk in Macintosh or DOS format from
the publisher. Some of the techniques described include rule-based
pattern matching (GPS, Eliza, a subset of Macsyma, the Emycin expert
system shell), constraint propagation and backtracking (Waltz
line-labelling), alpha-beta search (Othello), natural language
processing (top-down, bottom-up and chart parsing), logic-programming
(unification and Prolog), interpreters and compilers for Scheme, and
object-oriented programming (CLOS).

The examples are also used to illustrate good programming style and
efficiency. There is a guide to trouble-shooting and debugging Lisp
programs, a style guide, and a discussion of portability problems.
Some of the efficiency techniques described include memoization,
data indexing, compilation, delaying computation, proper use of
declarations, avoiding garbage collection, and choosing and using the
correct data structure.

The book also serves as an advanced introduction to Common Lisp, with
sections on the Loop macro, CLOS and sequences, and some coverage of
error handling, series, and the package facility.

2. Eugene Charniak, Christopher K. Riesbeck, Drew V. McDermott
and James R. Meehan.
"Artificial Intelligence Programming", 2nd edition.
Lawrence Erlbaum Associates (Hillsdale, NJ), 1987.
533 pages, ISBN 0-89-85960-9-2, $29.95.

Provides many nice code fragments, all of which are written
in Common Lisp. The first half of the book covers topics
like macros, the reader, data structures, control structures,
and defstructs. The second half of the book describes
programming techniques specific to AI, such as
discrimination nets, production systems, deductive database
retrieval, logic programming, and truth maintenance.

3. Patrick H. Winston and Berthold K. P. Horn.
"LISP", 3rd edition.
Addison-Wesley (Reading, MA), 1989. 611 pages. ISBN 0-201-08319-1
Covers the basic concepts of the language, but also gives a lot
of detail about programming AI topics such as rule-based expert
systems, forward chaining, interpreting transition trees,
compiling transition trees, object oriented programming,
and finding patterns in images. Not a tutorial. Has many
good examples. Source code for the examples is available by
anonymous ftp from ftp.ai.mit.edu:/pub/lisp3/. (The code runs in
Lucid, Allegro, KCL, GCLisp, MCL, Symbolics Genera. Send mail
with subject line "help" to ai3@ai.mit.edu for more information.)

4. John R. Anderson, Albert T. Corbett, and Brian J. Reiser.
"Essential LISP"
Addison-Wesley (Reading, MA), 1987.
352 pages, ISBN 0-20-11114-8-9, $23.95.
Concentrates on how to use Lisp with iteration and recursion.

5. Robert D. Cameron and Anthony H. Dixon
"Symbolic Computing with Lisp"
Prentice-Hall, 1992, 326 pages. ISBN 0-13-877846-9.
The book is intended primarily as a third-year computer science
text. In terms of programming techniques, it emphasizes recursion
and induction, data abstraction, grammar-based definition of Lisp
data structures and functional programming style. It uses
two Lisp languages:
(1) a purely functional subset of Lisp called Small Lisp and
(2) Common Lisp.
An MS-DOS interpreter for Small Lisp (including source) is
provided with the book. It considers applications of Lisp
to formal symbolic data domains: algebraic expressions,
logical formulas, grammars and programming languages.

6. Tony Hasemer and John Domingue.
"Common Lisp Programming for Artificial Intelligence"
Addison-Wesley, Reading, MA, 1989. 444 pages, ISBN 0-20-11757-9-7.

This book presents an introduction to Artificial Intelligence
with an emphasis on the role of knowledge representation. Three
chapters focus on object-oriented programming, including the
construction and use of a subset of CLOS.

The authors' research into the problems faced by novice Lisp
users influenced the content and style of the book. (The authors
are members of the Human Cognition Research Laboratory at the
Open University in the United Kingdom.) The book employs a
tutorial approach, especially in areas that students often find
difficult, such as recursion. Early and progressive treatment of
the evaluator promotes understanding of program execution.
Hands-on exercises are used to reinforce basic concepts.

The book assumes no prior knowledge of Lisp or AI and is a
suitable textbook for students in Cognitive Science, Computer
Science and other disciplines taking courses in Lisp or AI
programming as well as being invaluable for professional
programmers who are learning Lisp for developing AI applications.

7. Steven Tanimoto
"The Elements of Artificial Intelligence Using Common Lisp", 2nd edition
Computer Science Press, New York, 1995.
562 pages, ISBN 0-71-67826-9-3, (ISBN 0-71-67823-0-8, 1990, $48).

8. Patrick R. Harrison
"Common Lisp and Artificial Intelligence"
Prentice Hall, Englewood Clifs, NJ, 1990.
244 pages, ISBN 0-13-1552430, $22.50.

9. Paul Graham
"On Lisp: Advanced Techniques for Common Lisp"
Prentice Hall, Englewood Clifs, NJ, 1994. 413 pages, ISBN 0-13-030552-9.
Emphasizes a bottom-up style of writing programs, which he
claims is natural in Lisp and has advantages over the
traditional way of writing programs in C and Pascal.
Also has in-depth sections on writing macros with several
nice examples. Source code is available by anonymous ftp from
ftp.das.harvard.edu:/pub/onlisp/
as a single 56kb file.

10. John A. Moyne
"Lisp: A first language for computing"
Van Nostrand Reinhold, New York, 1991. 278 pages, ISBN 0442004265.

General Lisp reference books include:

1. ANSI/X3J13
Programming Language Common Lisp (ANSI/X3.226-1994)
American National Standards Institute
11 West 42nd Street, New York, NY 10036.
http://www.ansi.org/

2. Kent M. Pitman
Common Lisp HyperSpec (TM)
Harlequin, Inc., 1996.
This is an HTML-only document available via the web.
Available for browsing from
http://www.harlequin.com/books/HyperSpec/FrontMatter/
Available free for download (subject to some legal restrictions) from
http://www.harlequin.com/books/HyperSpec/
Includes text from ANSI/X3.226-1994 and other design rationales.

3. Guy L. Steele
"Common Lisp: The Language" [CLtL1]
Digital Press, 1984. 465 pages. ISBN 0-932376-41-X.

4. Guy L. Steele
"Common Lisp: The Language, 2nd Edition" [CLtL2]
Digital Press, 1990. 1029 pages, ISBN 1-55558-041-6 paperbound ($39.95).

[Butterworth-Heinemann, the owners of Digital Press, have made
the LaTeX sources to this book available by anonymous FTP from
cambridge.apple.com:/pub/CLTL/
A copy of the distribution is also available from
ftp.cs.cmu.edu:/user/ai/lang/lisp/doc/cltl/
The paperbound version of the book is, of course, available at
fine bookstores, or contact them directly at Digital Press,
225 Wildwood Street, Woburn, MA 01801, call 800-366-2665
(617-928-2527), or fax 800-446-6520 (617-933-6333). A copy of
the Digital Press book catalog is available from the same FTP location.]

A html version, produced using latex2html on the latex sources,
is accessible via the URL:
http://www.cs.cmu.edu/Web/Groups/AI/html/cltl/cltl2.html

5. Franz Inc.
"Common Lisp: The Reference"
Addison-Wesley, Reading, MA 1988. ISBN 0-201-11458-5
Entries on Lisp (CLtL1) functions in alphabetical order.

6. How to pass commands to LG3?

By selecting general operations from the tools menu. You can think of the tools as building blocks - each tool corresponding to several lines of LISP code. The tools you use and the order in which you select them defines what your program does.

7. What is the difference between Scheme and Common Lisp?

Scheme is a dialect of Lisp that stresses conceptual elegance and
simplicity. It is specified in R4RS and IEEE standard P1178. (See
the Scheme FAQ for details on standards for Scheme.) Scheme is much
smaller than Common Lisp; the specification is about 50 pages,
compared to Common Lisp's 1300 page draft standard. (See question
[4-10] for details on standards for Common Lisp.) Advocates of Scheme
often find it amusing that the Scheme standard is shorter than the
index to CLtL2.

Scheme is often used in computer science curricula and programming
language research, due to its ability to represent many programming
abstractions with its simple primitives. Common Lisp is often used for
real world programming because of its large library of utility
functions, a standard object-oriented programming facility (CLOS), and
a sophisticated condition handling system.

See the Scheme FAQ for information about object-oriented programming
in Scheme.

In Common Lisp, a simple program would look something like the
following:

(defun fact (n)
(if (< n 2)
1
(* n (fact (1- n)))))

In Scheme, the equivalent program would like like this:

(define fact
(lambda (n)
(if (< n 2)
1
(* n (fact (- n 1))))))

Experienced Lisp programmers might write this program as follows in order
to allow it to run in constant space:

(defun fact (n)
(labels ((tail-recursive-fact (counter accumulator)
(if (> counter n)
accumulator
(tail-recursive-fact (1+ counter)
(* counter accumulator)))))
(tail-recursive-fact 1 1)))

Whereas in Scheme the same computation could be written as follows:

(define fact
(lambda (n)
(letrec ((tail-recursive-fact
(lambda (counter accumulator)
(if (> counter n)
accumulator
(tail-recursive-fact (+ counter 1)
(* counter accumulator))))))
(tail-recursive-fact 1 1))))

or perhaps (using IEEE named LETs):

(define fact
(lambda (n)
(let loop ((counter n)
(accumulator 1))
(if (< counter 2)
accumulator
(loop (- counter 1)
(* accumulator counter))))))

Some Schemes allow one to use the syntax (define (fact n) ...) instead
of (define fact (lambda (n) ...)).

8. How to save an executable image of my loaded Lisp system? How to run a Unix command in Lisp? How to exit Lisp? Access environment variables?

There is no standard for dumping a Lisp image. Here are the
commands from some lisp implementations:
Lucid: DISKSAVE
Symbolics: Save World [CP command]
CMU CL: SAVE-LISP
Franz Allegro: EXCL:DUMPLISP (documented)
SAVE-IMAGE (undocumented)
Medley: IL:SYSOUT or IL:MAKESYS
MCL: SAVE-APPLICATION <pathname>
&key :toplevel-function :creator :excise-compiler
:size :resources :init-file :clear-clos-caches
KCL: (si:save-system "saved_kcl")
LispWorks: LW:SAVE-IMAGE
Be sure to garbage collect before dumping the image. You may need to
experiment with the kind of garbage collection for large images, and
may find better results if you build the image in stages.

There is no standard for running a Unix shell command from Lisp,
especially since not all Lisps run on top of Unix. Here are the
commands from some Lisp implementations:
Allegro: EXCL:RUN-SHELL-COMMAND (command &key input output
error-output wait if-input-does-not-exist
if-output-exists if-error-output-exists)
Lucid: RUN-PROGRAM (name
&key input output
error-output (wait t) arguments
(if-input-does-not-exist :error)
(if-output-exists :error)
(if-error-output-exists :error))
KCL: SYSTEM
For example, (system "ls -l").
You can also try RUN-PROCESS and EXCLP, but they
don't work with all versions of KCL.
CMU CL: RUN-PROGRAM (program args
&key (env *environment-list*) (wait t) pty input
if-input-does-not-exist output
(if-output-exists :error) (error :output)
(if-error-exists :error) status-hook before-execve)
LispWorks: FOREIGN:CALL-SYSTEM-SHOWING-OUTPUT

To toggle source file recording and cross-reference annotations, use
Allegro: excl:*record-source-file-info*
excl:*load-source-file-info*
excl:*record-xref-info*
excl:*load-xref-info*
LispWorks: (toggle-source-debugging nil)

Memory management:
CMU CL: (bytes-consed-between-gcs) [this is setfable]
Lucid: (change-memory-management
&key growth-limit expand expand-reserved)
Allegro: *tenured-bytes-limit*
LispWorks: LW:GET-GC-PARAMETERS
(use LW:SET-GC-PARAMETERS to change them)

Environment Variable Access:
Allegro: (sys:getenv var)
(sys:setenv var value) or (setf (sys:getenv var) value)
Lucid: (environment-variable var)
(set-environment-variable var value)
CMU CL 17: (cdr (assoc (intern var :keyword) *environment-list*))
{A}KCL, GCL: (system:getenv var)
CLISP: (system::getenv var)

Exiting/Quitting:
CLISP: EXIT
Allegro: EXIT (&optional excl::code &rest excl::args
&key excl::no-unwind excl::quiet)
LispWorks: BYE (&optional (arg 0))
Lucid: QUIT (&optional (lucid::status 0))
CMU CL: QUIT (&optional recklessly-p)

9. Why we need LISP?

In short, no single improvement you can make to your AutoCAD system will save you more time, effort, and money. You can spend thousands on the latest generation computers, the fastest video cards, and so on, but that won't make nearly as big a difference as automating your system with software. With an arsenal of LISP routines, you will send accuracy, consistency, and productivity soaring while greatly reducing the stress and strain of CAD operation. The right software is the key, and there is no amount of software you can buy that beats being able to program AutoCAD yourself with as many tailor-made routines as you want. And that is exactly what the LISP Generator enables you to do.

10. Explain the purpose of this newsgroup?

The newsgroup comp.lang.lisp exists for general discussion of
topics related to the programming language Lisp. For example, possible
topics can include (but are not necessarily limited to):
announcements of Lisp books and products
discussion of programs and utilities written in Lisp
discussion of portability issues
questions about possible bugs in Lisp implementations
problems porting an implementation to some architecture
Postings should be of general interest to the Lisp community. See also
question [4-9]. Postings asking for solutions to homework problems are
inappropriate.

The comp.lang.lisp newsgroup is archived in
ftp.cs.cmu.edu:/user/ai/pubs/news/comp.lang.lisp/
on a weekly basis.

Every so often, somebody posts an inflammatory message, such as
My programming language is better than yours (Lisp vs. C/Prolog/Scheme).
Loop (or Series) should/shouldn't be part of the language.
These "religious" issues serve no real purpose other than to waste
bandwidth. If you feel the urge to respond to such a post, please do
so through a private e-mail message.

Questions about object oriented programming in Lisp should be directed
to the newsgroup comp.lang.clos. Similarly, questions about the
programming language Scheme should be directed to the newsgroup
comp.lang.scheme. Discussion of functional programming language issues
should be directed to the newsgroup comp.lang.functional. Discussion
of AI programs implemented in Lisp should sometimes be cross-posted to
the newsgroup comp.ai.

Download Interview PDF