FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting] 
Author Message
 FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]

Archive-name: lisp-faq/part1
Last-Modified: Mon Jan 17 14:48:14 1994 by Mark Kantrowitz
Version: 1.42

;;; ****************************************************************
;;; Answers to Frequently Asked Questions about Lisp ***************
;;; ****************************************************************
;;; Written by Mark Kantrowitz and Barry Margolin
;;; lisp_1.faq -- 60712 bytes

This post contains Part 1 of the Lisp FAQ.

If you think of questions that are appropriate for this FAQ, or would

Note that the lisp-faq mailing list is for discussion of the content
of the FAQ posting only.  It is not the place to ask questions about Lisp;

comp.lang.lisp newsgroup for that.  If a question appears frequently
in one of those forums, it will get added to the FAQ list.

There are currently seven parts to the Lisp FAQ:
   1. Introductory Matter and Bibliography of Introductions and References
   2. General Questions
   3. Common Programming Pitfalls
   4. Lisp Implementations and Mailing Lists
   5. Object-oriented Programming in Lisp
   6. FTP Archives and Resources
   7. Lisp Window Systems and GUIs
All parts are posted to comp.lang.lisp. Part 5 is cross-posted to the
comp.lang.clos newsgroup.  

Topics Covered (Part 1):

  [1-0]   What is the purpose of this newsgroup?
  [1-1]   What is the difference between Scheme and Common Lisp?
  [1-2]   What documentation is available on Lisp? How can I learn Lisp?
  [1-3]   How can I improve my Lisp programming style and coding efficiency?
  [1-4]   Where can I learn about implementing Lisp interpreters and compilers?
  [1-5]   What does CLOS, PCL, X3J13, CAR, CDR, ... mean?
  [1-6]   Lisp Job Postings

Topics Covered (Part 2):

  [2-1]   Is there a GNU-Emacs interface to Lisp?
  [2-2]   When should I use a hash table instead of an association list?
  [2-3]   What is the equivalent of EXPLODE and IMPLODE in Common Lisp?
  [2-4]   Is Lisp inherently slower than more conventional languages such as C?
  [2-5]   Why does Common Lisp have "#'"?
  [2-6]   How do I call non-Lisp functions from Lisp?
  [2-7]   Can I call Lisp functions from other languages?
  [2-8]   I want to call a function in a package that might not exist at
          compile time. How do I do this?  
  [2-9]   What is CDR-coding?
  [2-10]  What is garbage collection?
  [2-11]  How do I save an executable image of my loaded Lisp system?
          How do I run a Unix command in my Lisp?
  [2-12]  I'm porting some code from a Symbolics Lisp machine to some
          other platform, and there are strange characters in the code.
          What do they mean?  
  [2-13]  History: Where did Lisp come from?
  [2-14]  How do I find the argument list of a function?
          How do I get the function name from a function object?
  [2-15]  How can I have two Lisp processes communicate via unix sockets?
  [2-16]  How can I create a stream that acts like UNIX's /dev/null
          (i.e., gobbles any output and immediately signals EOF on
          input operations)?
  [2-17]  Read-time conditionalization of code (#+ #- and *features*)
  [2-18]  What reader macro characters are used in major Lisp systems?
  [2-19]  How do I determine if a file is a directory or not?
          How do I get the current directory name from within a Lisp
          program? Is there any way to create a directory?
  [2-20]  What is a "Lisp Machine" (LISPM)?

Common Pitfalls (Part 3):

  [3-0]  Why does (READ-FROM-STRING "foobar" :START 3) return FOOBAR
         instead of BAR?  
  [3-1]  Why can't it deduce from (READ-FROM-STRING "foobar" :START 3)
         that the intent is to specify the START keyword parameter
         rather than the EOF-ERROR-P and EOF-VALUE optional parameters?  
  [3-2]  Why can't I apply #'AND and #'OR?
  [3-3]  I used a destructive function (e.g. DELETE, SORT), but it
         didn't seem to work.  Why?
  [3-4]  After I NREVERSE a list, it's only one element long.  After I
         SORT a list, it's missing things.  What happened?
  [3-5]  Why does (READ-LINE) return "" immediately instead of waiting
         for me to type a line?  
  [3-6]  I typed a form to the read-eval-print loop, but nothing happened. Why?
  [3-7]  DEFMACRO doesn't seem to work.
         When I compile my file, LISP warns me that my macros are undefined
         functions, or complains "Attempt to call <function> which is
         defined as a macro.
  [3-8]  Name conflict errors are driving me crazy! (EXPORT, packages)
  [3-9]  Closures don't seem to work properly when referring to the
         iteration variable in DOLIST, DOTIMES, DO and LOOP.
  [3-10] What is the difference between FUNCALL and APPLY?
  [3-11] Miscellaneous things to consider when debugging code.
  [3-12] When is it right to use EVAL?
  [3-13] Why does my program's behavior change each time I use it?
  [3-14] When producing formatted output in Lisp, where should you put the
         newlines (e.g., before or after the line, FRESH-LINE vs TERPRI,
         ~& vs ~% in FORMAT)?
  [3-15] I'm using DO to do some iteration, but it doesn't terminate.
  [3-16] My program works when interpreted but not when compiled!

Lisp Implementations and Mailing Lists (Part 4):

  [4-0]   Free Common Lisp implementations.
  [4-1]   Commercial Common Lisp implementations.
  [4-1a]  Lisp-to-C translators
  [4-2]   Scheme Implementations
  [4-4]   Free Implementations of Other Lisp Dialects
  [4-5]   Commercial Implementations of Other Lisp Dialects
  [4-6]   What is Dylan?
  [4-7]   What is Pearl Common Lisp?
  [4-9]   What Lisp-related discussion groups and mailing lists exist?
  [4-10]  ANSI Common Lisp -- Where can I get a copy of the draft standard?

Object-oriented Programming in Lisp (Part 5):

  [5-0]   What is CLOS (PCL) and where can I get it?
          How do you pronounce CLOS?
  [5-1]   What documentation is available about object-oriented
          programming in Lisp?  
  [5-2]   How do I write a function that can access defstruct slots by
          name?  I would like to write something like
          (STRUCTURE-SLOT <object> '<slot-name>).  
  [5-3]   How can I list all the CLOS instances in a class?
  [5-4]   How can I store data and CLOS instances (with possibly circular
          references) on disk so that they may be retrieved at some later
          time?
  [5-5]   Given the name of a class, how can I get the names of its slots?
  [5-6]   Free CLOS software.

FTP Resources (Part 6):

  [6-0] General information about FTP Resources for Lisp
  [6-1] Repositories of Lisp Software
  [6-3] Publicly Redistributable Lisp Software
  [6-6] Formatting code in{*filter*}
  [6-7] Where can I get an implementation of Prolog in Lisp?

Lisp Window Systems and GUIs (Part 7):
  [7-1] How can I use the X Window System or other GUIs from Lisp?
  [7-2] What Graphers/Browsers are available?

Search for \[#\] to get to question number # quickly.

Recent Changes:

;;; 1.42:
;;; 17-JAN-94 mk    Added "dpANS" to [1-5].
;;; 25-JAN-94 mk    New location for WCL source.
;;;  1-FEB-94 mk    Updated [4-10] to reflect availability of dpANS2.
;;;  8-FEB-94 mk    Updated Lisp-to-C Translator in [4-1a].

Introduction:

Certain questions and topics come up frequently in the various network
discussion groups devoted to and related to Lisp.  This file/article is
an attempt to gather these questions and their answers into a convenient
reference for Lisp programmers.  It (or a reference to it) is posted
periodically.  The hope is that this will cut down on the user time and
network bandwidth used to post, read and respond to the same questions
over and over, as well as providing education by answering questions
some readers may not even have thought to ask.

This is not a Lisp tutorial, nor is it an exhaustive list of all Lisp
intricacies.  Lisp is a very powerful and expressive language, but with
that power comes many complexities.  This list attempts to address the
ones that average Lisp programmers are likely to encounter.  If you are
new to Lisp, see the answer to the question "How can I learn Lisp?".

The latest version of this file is available via anonymous FTP from CMU
and Thinking Machines:

   To obtain the files from CMU, connect by anonymous ftp to any CMU CS
   machine (e.g., ftp.cs.cmu.edu [128.2.206.173]), using username

   lisp_2.faq, lisp_3.faq, lisp_4.faq, lisp_5.faq, lisp_6.faq and
   lisp_7.faq are located in the directory
       /afs/cs.cmu.edu/project/ai-repository/ai/pubs/faqs/lisp/
   [Note: You must cd to this directory in one atomic operation, as
   some of the superior directories on the path are protected from
   access by anonymous ftp.] If your site runs the Andrew File System,
   you can just cp the files directly without bothering with FTP.

   To obtain the files from Thinking Machines, ftp them from ftp.think.com,
   in the directory /public/think/lisp/. The file faq.text contains all the
   parts of the FAQ in one file. In addition, specific versions of the FAQ
   are available as faq-<version>.text.

The FAQ postings are also archived in the periodic posting archive on
rtfm.mit.edu [18.70.0.209]. Look in the anonymous ftp directory
/pub/usenet/news.answers/ in the subdirectory lisp-faq/. If you do not
have anonymous ftp access, you can access the archive by mail server

with "help" and "index" in the body on separate lines for more
information.

Unless otherwise specified, the Lisp dialect referred to is Common Lisp,
as defined by "Common Lisp: the Language" (aka "CLtL1") as well as
corrections (but not enhancements) from "Common Lisp: the Language, 2nd
Edition" (aka "CLtL2"), both by Guy L. Steele, Jr. and published by
Digital Press. Note that CLtL2 is NOT an official specification for
the language; ANSI Committee X3J13 is preparing such a specification.
See question [4-10] for information on the status of the ANSI
specification for Common Lisp. Enhancements such as CLOS, conditions,
and the ...

read more »



Thu, 01 Aug 1996 16:00:47 GMT  
 FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]
Archive-name: lisp-faq/part2
Last-Modified: Mon Jan 17 14:48:23 1994 by Mark Kantrowitz
Version: 1.42

;;; ****************************************************************
;;; Answers to Frequently Asked Questions about Lisp ***************
;;; ****************************************************************
;;; Written by Mark Kantrowitz and Barry Margolin
;;; lisp_2.faq -- 46780 bytes

This post contains Part 2 of the Lisp FAQ.

If you think of questions that are appropriate for this FAQ, or would

Topics Covered (Part 2):

  [2-1]   Is there a GNU-Emacs interface to Lisp?
  [2-2]   When should I use a hash table instead of an association list?
  [2-3]   What is the equivalent of EXPLODE and IMPLODE in Common Lisp?
  [2-4]   Is Lisp inherently slower than more conventional languages such as C?
  [2-5]   Why does Common Lisp have "#'"?
  [2-6]   How do I call non-Lisp functions from Lisp?
  [2-7]   Can I call Lisp functions from other languages?
  [2-8]   I want to call a function in a package that might not exist at
          compile time. How do I do this?  
  [2-9]   What is CDR-coding?
  [2-10]  What is garbage collection?
  [2-11]  How do I save an executable image of my loaded Lisp system?
          How do I run a Unix command in my Lisp?
  [2-12]  I'm porting some code from a Symbolics Lisp machine to some
          other platform, and there are strange characters in the code.
          What do they mean?  
  [2-13]  History: Where did Lisp come from?
  [2-14]  How do I find the argument list of a function?
          How do I get the function name from a function object?
  [2-15]  How can I have two Lisp processes communicate via unix sockets?
  [2-16]  How can I create a stream that acts like UNIX's /dev/null
          (i.e., gobbles any output and immediately signals EOF on
          input operations)?
  [2-17]  Read-time conditionalization of code (#+ #- and *features*)  
  [2-18]  What reader macro characters are used in major Lisp systems?
  [2-19]  How do I determine if a file is a directory or not?
          How do I get the current directory name from within a Lisp
          program? Is there any way to create a directory?
  [2-20]  What is a "Lisp Machine" (LISPM)?

Search for \[#\] to get to question number # quickly.

----------------------------------------------------------------
Subject: [2-1] Is there a GNU-Emacs interface to Lisp?

ILISP is a powerful GNU-Emacs interface to many dialects of Lisp,
including Lucid, Allegro, {A}KCL, IBCL, and CMU. Written by Chris


haldane.bu.edu [128.197.54.25] in the directory pub/ilisp as the file
ilisp.tar.Z. If you want to be on the ilisp mailing list, to hear about



Franz Inc.'s GNU-Emacs/Lisp interface includes an online Common Lisp
manual. (The manual is available by license from Franz Inc. Contact

(without the online Common Lisp reference manual and some
Allegro-specific code) is available free from
   ftp.uu.net:/vendor/franz/emacs/eli-2.0.11.tar.gz
and takes advantage of GNU-Emacs 19.X's newest features, including
support for mouse input, pulldown menus, and multifont text. The
interface also supports Epoch 3.2 and 4.2, and LEmacs 19.6 and 19.8.

(See also [1-2] for a hardcopy version of the Common Lisp reference manual.)

The cl-shell package provides a major mode (cl-shell-mode) for running
Common Lisp (CL) as an Emacs subprocess.  It provides a general
mechanism for communication between CL and Emacs which does not rely
on extra processes, and should therefore be easily portable to any
version of CL.  Features include direct (i.e., not through a temp file)
evaluation and in-package compilation of forms from lisp-mode buffers,
type-ahead and a history mechanism for the cl-shell buffer, and pop-up
help facilities for the CL functions documentation, macroexpand and
describe.  Extensions for Lucid Common Lisp provide pop-up arglists
and source file editing.  Other extensions are provided to allow
editing source files of CLOS or Flavors methods.  Cl-shell is
available on the Lucid tape (in the goodies directory) or via
anonymous ftp from whitechapel.media.mit.edu (18.85.0.125).

Lucid includes some other Emacs-Lisp interfaces in its goodies directory.

Harlequin's LispWorks includes an Emacs-Lisp interface.

Venue's Medley has an optional EMACS Interface.

GNU-Emacs itself is available by anonymous ftp from prep.ai.mit.edu.

----------------------------------------------------------------
Subject: [2-2] When should I use a hash table instead of an association list?

Both association lists (alists) and hash tables may be used to
represent tabular data. Hash tables have an O(1) running time and
alists an O(n) running time, so hash tables are ultimately more
efficient than alists. However, if the alists are small, they can be
more efficient than hash tables, which have a large initial overhead.

Alists can sometimes be more efficient if the keys are sorted
according to frequency, with the most heavily accessed keys appearing
at the front of the list. But one doesn't always know this kind of
information, and even then the frequency distribution may be flat.

In Allegro CL 4.1 [SPARC; R1], the rule of thumb is that for less than
24 elements, linear search using alists beats hashing.  In Lucid CL
4.0.1 HP 9000/700, the break-even point is at 10 elements. The
break-even points vary in other lisps from as low as 4 elements to as
high as 100 elements. So if you're using alists in your code, using
hash tables instead may speed up your program.

A potential problem may occur, however, when the keys of an EQ or EQL
hash table are Lisp objects such as conses or arrays (or other objects
that are identified by their addresses). In most implementations, such
tables must be re-hashed after garbage collection. If your application
causes frequent GCs, this can adversely affect the performance of hash
table lookup. Since EQL-hashing and =-hashing of fixnums generally
don't require rehashing after GC, one way of avoiding this problem is
to include a unique identifier in each key object and hash on that
instead. Another solution is to use an EQUAL hash table if the keys
are conses or an EQUALP hash table if the keys are arrays or other
(non-circular!) structures.

----------------------------------------------------------------
Subject: [2-3] What is the equivalent of EXPLODE and IMPLODE in Common Lisp?

Hopefully, the only reason you need to do this is as part of trying to port
some old MacLisp code to Common Lisp.  These functions predated the
inclusion of strings as a first-class data type in Lisp; symbols were used
as strings, and they ere EXPLODEd to allow the individual characters to be
manipulated in a list.

Probably the best approximations of these are:

   (defun explode (object)
     (loop for char across (prin1-to-string object)
           collect (intern (string char))))

   (defun implode (list)
     (read-from-string (coerce (mapcar #'character list) 'string)))

An alternate definition of EXPLODE which uses MAP instead of LOOP is:

   (defun explode (object)
     (map 'list #'(lambda (char)
                    (intern (string char)))
          (prin1-to-string object)))

The creation of N conses of garbage to process a string of N
characters is a hideously inefficient way of doing the job.  Rewrite
EXPLODE code with PRIN1-TO-STRING, or better STRING if the arguments
are symbols without funny characters.  For IMPLODE, try to make its
caller use strings and try to make the result usable as a string to
avoid having to call INTERN or READ-FROM-STRING.

----------------------------------------------------------------
Subject: [2-4] Is Lisp inherently slower than more conventional languages
               such as C?

This is a tough question to answer, as you probably expected.  In many
cases, it appears to be.  Lisp does not require the programmer to specify
the data type of variables, so generic arithmetic operators may have to
perform type checking at runtime in order to determine how to proceed.
However, Lisp code can also be denser (i.e.  there is more expressed in a
single line) than many other languages: the Lisp expression (+ A B) is more
powerful than the C expression A+B (the Lisp version supports bignums,
rationals, and complex numbers, while the C version only supports
limited-size integers and floating point); therefore, one may claim that it
is reasonable that the Lisp version take longer than the C version (but
don't expect everyone to accept this rationalization).  Solutions to this
include hardware support (e.g. processors that support type tags in data,
such as SPARC and Symbolics Lisp Machines), declarations, and specialized
variants of functions (e.g. in MacLisp, + accepts and returns only fixnums,
+$ accepts and returns only flonums, and PLUS is generic).

At one time, the MIT PDP-10 MacLisp compiler was compared to DEC's
PDP-10 fortran compiler.  When appropriate declarations were supplied
in the Lisp code, the performance of compiled Lisp arithmetic rivaled
that of the Fortran code.  It would hardly be fair to compare Lisp
without declarations to Fortran, since the Fortran compiler would have
more information upon which it could base its optimizations. A more
recent test found that numeric code compiled with optimizations using
CMU CL is within the same ballpark as highly optimized Fortran code.
For unoptimized Fortran code, CMU CL was about 4 times faster.
Even the speed of numeric code generated by ...

read more »



Thu, 01 Aug 1996 16:01:04 GMT  
 FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]
Archive-name: lisp-faq/part3
Last-Modified: Mon Jan 17 14:48:31 1994 by Mark Kantrowitz
Version: 1.42

;;; ****************************************************************
;;; Answers to Frequently Asked Questions about Lisp ***************
;;; ****************************************************************
;;; Written by Mark Kantrowitz and Barry Margolin
;;; lisp_3.faq -- 35608 bytes

This post contains Part 3 of the Lisp FAQ.

If you think of questions that are appropriate for this FAQ, or would

This section contains a list of common pitfalls. Pitfalls are aspects
of Common Lisp which are non-obvious to new programmers and often
seasoned programmers as well.

Common Pitfalls (Part 3):

  [3-0]  Why does (READ-FROM-STRING "foobar" :START 3) return FOOBAR
         instead of BAR?  
  [3-1]  Why can't it deduce from (READ-FROM-STRING "foobar" :START 3)
         that the intent is to specify the START keyword parameter
         rather than the EOF-ERROR-P and EOF-VALUE optional parameters?  
  [3-2]  Why can't I apply #'AND and #'OR?
  [3-3]  I used a destructive function (e.g. DELETE, SORT), but it
         didn't seem to work.  Why?
  [3-4]  After I NREVERSE a list, it's only one element long.  After I
         SORT a list, it's missing things.  What happened?
  [3-5]  Why does (READ-LINE) return "" immediately instead of waiting
         for me to type a line?  
  [3-6]  I typed a form to the read-eval-print loop, but nothing happened. Why?
  [3-7]  DEFMACRO doesn't seem to work.
         When I compile my file, LISP warns me that my macros are undefined
         functions, or complains "Attempt to call <function> which is
         defined as a macro.
  [3-8]  Name conflict errors are driving me crazy! (EXPORT, packages)
  [3-9]  Closures don't seem to work properly when referring to the
         iteration variable in DOLIST, DOTIMES, DO and LOOP.
  [3-10] What is the difference between FUNCALL and APPLY?
  [3-11] Miscellaneous things to consider when debugging code.
  [3-12] When is it right to use EVAL?
  [3-13] Why does my program's behavior change each time I use it?
  [3-14] When producing formatted output in Lisp, where should you put the
         newlines (e.g., before or after the line, FRESH-LINE vs TERPRI,
         ~& vs ~% in FORMAT)?
  [3-15] I'm using DO to do some iteration, but it doesn't terminate.
  [3-16] My program works when interpreted but not when compiled!

Search for \[#\] to get to question number # quickly.

----------------------------------------------------------------
Subject: [3-0] Why does (READ-FROM-STRING "foobar" :START 3) return FOOBAR
               instead of BAR?

READ-FROM-STRING is one of the rare functions that takes both &OPTIONAL and
&KEY arguments:

       READ-FROM-STRING string &OPTIONAL eof-error-p eof-value
                               &KEY :start :end :preserve-whitespace

When a function takes both types of arguments, all the optional
arguments must be specified explicitly before any of the keyword
arguments may be specified.  In the example above, :START becomes the
value of the optional EOF-ERROR-P parameter and 3 is the value of the
optional EOF-VALUE parameter.

To get the desired result, you should use
   (READ-FROM-STRING "foobar" t nil :START 3)
If you need to understand and use the optional arguments, please refer
to CLTL2 under READ-FROM-STRING, otherwise, this will behave as
desired for most purposes.

----------------------------------------------------------------
Subject: [3-1] Why can't it deduce from (READ-FROM-STRING "foobar" :START 3)
      that the intent is to specify the START keyword parameter rather than
      the EOF-ERROR-P and EOF-VALUE optional parameters?

In Common Lisp, keyword symbols are first-class data objects.  Therefore,
they are perfectly valid values for optional parameters to functions.
There are only four functions in Common Lisp that have both optional and
keyword parameters (they are PARSE-NAMESTRING, READ-FROM-STRING,
WRITE-LINE, and WRITE-STRING), so it's probably not worth adding a
nonorthogonal kludge to the language just to make these functions slightly
less confusing; unfortunately, it's also not worth an incompatible change
to the language to redefine those functions to use only keyword arguments.

----------------------------------------------------------------
Subject: [3-2] Why can't I apply #'AND and #'OR?

Here's the simple, but not necessarily satisfying, answer: AND and OR are
macros, not functions; APPLY and FUNCALL can only be used to invoke
functions, not macros and special operators.

OK, so what's the *real* reason?  The reason that AND and OR are macros
rather than functions is because they implement control structure in
addition to computing a boolean value.  They evaluate their subforms
sequentially from left/top to right/bottom, and stop evaluating subforms as
soon as the result can be determined (in the case of AND, as soon as a
subform returns NIL; in the case of OR, as soon as one returns non-NIL);
this is referred to as "short circuiting" in computer language parlance.
APPLY and FUNCALL, however, are ordinary functions; therefore, their
arguments are evaluated automatically, before they are called.  Thus, were
APPLY able to be used with #'AND, the short-circuiting would be defeated.

Perhaps you don't really care about the short-circuiting, and simply want
the functional, boolean interpretation.  While this may be a reasonable
interpretation of trying to apply AND or OR, it doesn't generalize to other
macros well, so there's no obvious way to have the Lisp system "do the
right thing" when trying to apply macros.  The only function associated
with a macro is its expander function; this function accepts and returns
and form, so it cannot be used to compute the value.

The Common Lisp functions EVERY and SOME can be used to get the
functionality you intend when trying to apply #'AND and #'OR.  For
instance, the erroneous form:

   (apply #'and *list*)

can be translated to the correct form:

   (every #'identity *list*)

----------------------------------------------------------------
Subject: [3-3] I used a destructive function (e.g. DELETE, SORT), but
               it didn't seem to work.  Why?

I assume you mean that it didn't seem to modify the original list.  There
are several possible reasons for this.  First, many destructive functions
are not *required* to modify their input argument, merely *allowed* to; in
some cases, the implementation may determine that it is more efficient to
construct a new result than to modify the original (this may happen in Lisp
systems that use "CDR coding", where RPLACD may have to turn a CDR-NEXT or
CDR-NIL cell into a CDR-NORMAL cell), or the implementor may simply not
have gotten around to implementing the destructive version in a truly
destructive manner.  Another possibility is that the nature of the change
that was made involves removing elements from the front of a list; in this
case, the function can simply return the appropriate tail of the list,
without actually modifying the list. And example of this is:

   (setq *a* (list 3 2 1))
   (delete 3 *a*) => (2 1)
   *a* => (3 2 1)

Similarly, when one sorts a list, SORT may destructively rearrange the
pointers (cons cells) that make up the list. SORT then returns the cons
cell that now heads the list; the original cons cell could be anywhere in
the list. The value of any variable that contained the original head of the
list hasn't changed, but the contents of that cons cell have changed
because SORT is a destructive function:

   (setq *a* (list 2 1 3))
   (sort *a* #'<) => (1 2 3)
   *a* => (2 3)    

In both cases, the remedy is the same: store the result of the
function back into the place whence the original value came, e.g.

   (setq *a* (delete 3 *a*))
   *a* => (2 1)

Why don't the destructive functions do this automatically?  Recall
that they are just ordinary functions, and all Lisp functions are
called by value. They see the value of the argument, not the argument
itself. Therefore, these functions do not know where the lists they
are given came from; they are simply passed the cons cell that
represents the head of the list. Their only obligation is to return
the new cons cell that represents the head of the list. Thus
"destructive" just means that the function may munge the list by
modifying the pointers in the cars and cdrs of the list's cons cells.
This can be more efficient, if one doesn't care whether the original
list gets trashed or not.

One thing to be careful about when doing this (storing the result back
into the original location) is that the original list might be
referenced from multiple places, and all of these places may need to
be updated.  For instance:

   (setq *a* (list 3 2 1))
   (setq *b* *a*)
   (setq *a* (delete 3 *a*))
   *a* => (2 1)
   *b* => (3 2 1) ; *B* doesn't "see" the change
   (setq *a* (delete 1 *a*))
   *a* => (2)
   *b* => (3 2) ; *B* sees the change this time, though

One may argue that destructive functions could do what you expect by
rearranging the CARs of the list, shifting things up if the first element
is being deleted, as they are likely to do if the argument is a vector
rather than a list.  In many cases they could do this, although it would
clearly be slower.  However, there is one case where this is not possible:
when the argument or value is NIL, and the value or argument, respectively,
is not.  It's not possible to transform the object referenced from the
original cell from one data type to another, so the result must be stored
back.  Here are some examples:

   (setq *a* (list 3 2 1))
   (delete-if #'numberp *a) => NIL
   *a* => (3 2 1)
   (setq *a* nil *b* '(1 2 3))
   (nconc *a* *b*) => (1 2 3)
   *a* => NIL

The names of most destructure functions (except for sort, delete,
rplaca, rplacd, and setf of accessor functions) have the prefix ...

read more »



Thu, 01 Aug 1996 16:01:18 GMT  
 FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]
Archive-name: lisp-faq/part4
Last-Modified: Mon Jan 17 14:48:37 1994 by Mark Kantrowitz
Version: 1.42

;;; ****************************************************************
;;; Answers to Frequently Asked Questions about Lisp ***************
;;; ****************************************************************
;;; lisp_4.faq -- 54874 bytes

This post contains Part 4 of the Lisp FAQ.

If you think of questions that are appropriate for this FAQ, or would

Lisp/Scheme Implementations and Mailing Lists (Part 4):

  [4-0]   Free Common Lisp implementations.
  [4-1]   Commercial Common Lisp implementations.
  [4-1a]  Lisp to C translators
  [4-2]   Scheme Implementations
  [4-4]   Free Implementations of Other Lisp Dialects
  [4-5]   Commercial Implementations of Other Lisp Dialects
  [4-6]   What is Dylan?
  [4-7]   What is Pearl Common Lisp?
  [4-9]   What Lisp-related discussion groups and mailing lists exist?
  [4-10]  ANSI Common Lisp -- Where can I get a copy of the draft standard?

Search for \[#\] to get to question number # quickly.

----------------------------------------------------------------
Subject: [4-0]   Free Common Lisp implementations.

Repositories of Lisp source code are described in the answer to
question [6-1].

Remember, when ftping compressed or compacted files (.Z, .arc, .fit,
etc.) to use binary mode for retrieving the files.

   Kyoto Common Lisp (KCL) is free, but requires a license. Conforms to CLtL1.


   (AKCL) is a collection of ports, bug fixes and improvements to KCL

   generates C code which it compiles with the local C compiler. Both are
   available by anonymous ftp from rascal.ics.utexas.edu [128.83.138.20],
   ftp.cli.com [192.31.85.1], or [133.11.11.11] (a machine in Japan)
   in the directory /pub. KCL is in the file kcl.tar, and AKCL is in the
   file akcl-xxx.tar.Z (take the highest value of xxx).  To obtain KCL, one
   must first sign and mail a copy of the license agreement to: Special
   Interest Group in LISP, c/o Taiichi Yuasa, Department of Computer Science,
   Toyohashi University of Technology, Toyohashi 441, JAPAN. Runs on Sparc,
   IBM RT, RS/6000, DecStation 3100, hp300, hp800, Macintosh II (under AUX),
   mp386, IBM PS2, Silicon Graphics 4d, Sun3, Sun4, Sequent Symmetry,
   IBM 370, NeXT and Vax. A port to DOS is in beta test as
   math.utexas.edu:pub/beta2.zip. Commercial versions of {A}KCL are available
   from Austin Code Works, 11100 Leafwood Lane, Austin, TX 78750-3409,

   including a CLOS for AKCL. See also Ibuki, below.

   XLISP is free, and runs on the IBM PC (MSDOS), Amiga (AmigaDOS),
   Atari ST (TOS), Apple Macintosh, and Unix. It should run on
   anything with a C compiler.  It was written by David Michael Betz,
   167 Villa Avenue #11, Los Gatos, CA 95032, 408-354-9303 (H),

   written by Tim Mikkelsen. Version 2.0 is available by anonymous ftp from
           cs.orst.edu:/pub/xlisp/ [128.193.32.1] or
           sumex-aim.stanford.edu:info-mac/lang/
   Version 2.1 is the same as XLISP 2.0, but modified by Tom Almy to
   bring it closer to Common Lisp and with several bugs fixed. It can
   be obtained by anonymous ftp from
           ftp.biostr.washington.edu:/pub/xlisp      [128.95.10.115]
           wasp.eng.ufl.edu:/pub                     [128.227.116.1]
   as the files xlisp21e.zip and xlisp21e.tar.Z. The xlisp21e.zip file comes
   with IBM/PC executables. A Macintosh port of version 2.1e (and the
   C source code to its interface) is also available, from Macintosh
   ftp sites such as sumex.stanford.edu:/info-mac/dev/xlisp-21e2.hqx
   and mac.archive.umich.edu:/mac/development/languages/xlisp2.1e2.sit.hqx.

   For obtaining a copy through US mail, send email to Tom Almy,

   version of xlisp is available by anonymous ftp from
   ftp.cica.indiana.edu:/util/ as wxlslib.zip.  

   CMU Common Lisp (CMU CL) is free, and runs on HPs, Sparcs (Mach and SunOs),
   DecStation 3100 (Mach), IBM RT (Mach) and requires 16mb RAM, 25mb
   disk. It includes an incremental compiler, Hemlock emacs-style editor,
   source-code level de{*filter*}, code profiler and is mostly X3J13
   compatible, including the new loop macro.  It is available by anonymous
   ftp from any CMU CS machine, such as ftp.cs.cmu.edu [128.2.206.173], in the
   directory /afs/cs.cmu.edu/project/clisp/release. Login with username

   security restrictions on anonymous ftps (some of the superior
   directories on the path are protected against outside access), it is
   important to "cd" to the source directory with a single command.
   Don't forget to put the ftp into binary mode before using "get" to
   obtain the compressed/tarred files. The binary releases are
   contained in files of the form
                <version>-<machine>_<os>.tar.Z
   Other files in this directory of possible interest are
   16f-source.tar.Z, which contains all the ".lisp" source files
   used to build version 16f. A listing of the current contents of the
   release area is in the file FILES. You may also use "dir" or "ls" to

   WCL is an implementation of Common Lisp for Sparc based workstations.
   It is available free by anonymous ftp from
      gummo.stanford.edu:pub/miscellany/wcl/  [36.93.0.31]
   The file wcl-2.14.tar.Z contains the WCL distribution, including CLX
   and PCL; wgdb-4.2.tar.Z contains a version of the GDB de{*filter*} which
   has been modified to grok WCL's Lisp; and gcc-2.1.tar.Z contains the
   GNU C compiler (2.2.2 does not work!).  WCL provides a large subset of
   Common Lisp as a Unix shared library that can be linked with Lisp and
   C code to produce efficient and small applications. For example, the
   executable for a Lisp version of the canonical ``Hello World!''
   program requires only 40k bytes under SunOS 4.1 for SPARC. WCL
   provides CLX R5 as a shared library, and comes with PCL and a few
   other utilities.  For further information on WCL, see the paper
   published in the proceedings of the 1992 Lisp and Functional
   Programming Conference, a copy of which appears in the wcl directory
   as lfp-paper.ps, or look in the documentation directory of the WCL


   like to be added to a mailing list for information about new releases,

   CLISP is a Common Lisp (CLtL1 + parts of CLtL2) implementation by
   Bruno Haible of Karlsruhe University and Michael Stoll of Munich
   University, both in Germany.  It runs on microcomputers (DOS, OS/2,
   Atari ST, Amiga 500-4000) as well as on Unix workstations (Linux, Sun4,
   Sun386, HP9000/800, SGI, Sun3 and others) and needs only 1.5 MB of RAM.
   It is free software and may be distributed under the terms of GNU GPL.
   German and English versions are available, French coming soon.  CLISP
   includes an interpreter, a compiler, a subset of CLOS and, for some
   machines, a screen editor. Packages running in CLISP include PCL and,
   on Unix machines, CLX and Garnet.  Available by anonymous ftp from
   ma2s2.mathematik.uni-karlsruhe.de [129.13.115.2] in the directory
   /pub/lisp/clisp.  For more information, contact

   There is a mailing list for users of CLISP. It is the proper forum for
   questions about CLISP, installation problems, bug reports, application
   packages etc. For information about the list and how to subscribe,

          help
          information clisp-list
   in the message body.
   A Sybase SQL interface interface for CLIPS is available
   by anonymous ftp from wuarchive.wustl.edu:packages/clips2sybase/. For

   CLiCC (Common Lisp to C Compiler) generates C-executables from Common
   Lisp application programs. CLiCC is not a Common Lisp system, and
   hence does not include any program development or debugging support.
   CLiCC is intended to be used as an add-on to existing Common Lisp
   systems for generating portable applications.  CLiCC supports CL_0, a
   subset of Common Lisp + CLOS, which excludes EVAL and related
   functions. At present CL_0 is based on CLtL1, but is headed towards
   CLtL2 and ANSI-CL. The generated C code (ANSI-C or K&R-C compatible)
   may be compiled using a conventional C compiler on the target
   machine, and must be linked with the CLiCC runtime library in order
   to generate executables. CLiCC is available by anonymous ftp from
      ftp.informatik.uni-kiel.de:pub/kiel/apply/clicc-0.6.1.tar.Z
      [134.245.15.113].  



   Kiel, Institut fuer Informatik und Praktische Mathematik,
   Preusserstr.  1-9, D-24105 Kiel, Germany. The authors welcome
   suggestions and improvements and would appreciate receiving email
   even if you just used CLiCC successfully.

   RefLisp is a small Lisp interpreter. Versions exist for MS-DOS and
   UNIX (AIX). The MS-DOS version supports CGA/EGA/VGA graphics and the
...

read more »



Thu, 01 Aug 1996 16:01:31 GMT  
 FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]
Archive-name: lisp-faq/part5
Last-Modified: Mon Jan 17 14:48:45 1994 by Mark Kantrowitz
Version: 1.42

;;; ****************************************************************
;;; Answers to Frequently Asked Questions about Lisp ***************
;;; ****************************************************************
;;; Written by Mark Kantrowitz and Barry Margolin
;;; lisp_5.faq -- 17899 bytes

This post contains Part 5 of the Lisp FAQ. It is cross-posted to the
newsgroup comp.lang.clos because it contains material of interest to
people concerned with CLOS, PCL and object-oriented programming in
Lisp. The other parts of the Lisp FAQ are posted only to the
newsgroups comp.lang.lisp and news.answers.

If you think of questions that are appropriate for this FAQ, or would

CLOS/PCL Questions (Part 5):

  [5-0]   What is CLOS (PCL) and where can I get it?
          How do you pronounce CLOS?
  [5-1]   What documentation is available about object-oriented
          programming in Lisp?  
  [5-2]   How do I write a function that can access defstruct slots by
          name?  I would like to write something like
          (STRUCTURE-SLOT <object> '<slot-name>).  
  [5-3]   How can I list all the CLOS instances in a class?
  [5-4]   How can I store data and CLOS instances (with possibly circular
          references) on disk so that they may be retrieved at some later
          time?
  [5-5]   Given the name of a class, how can I get the names of its slots?
  [5-6]   Free CLOS software.

Search for \[#\] to get to question number # quickly.

In general, questions about object oriented programming in Lisp,
especially questions about using CLOS or compiling PCL, should be
directed to the newsgroup comp.lang.clos.

----------------------------------------------------------------
Subject: [5-0]  What is CLOS (PCL) and where can I get it?
                How do you pronounce CLOS?

CLOS (Common Lisp Object System) is the object-oriented programming
standard for Common Lisp. It is the successor to Symbolics FLAVORS and
Xerox LOOPS (Lisp Object Oriented Programming System). The acronym
CLOS is pronouned either as "See-Loss" or "Closs", depending on taste.
PCL (Portable Common Loops) is a portable CLOS implementation, and is
available by anonymous ftp from parcftp.xerox.com (13.1.64.94) in the
/pub/pcl/ directory. Also in the same directory are sources for CLX R5
and an inspecter.

Most Common Lisp implementations now include their own CLOS
implementations. Common Lisp implementations with native CLOS include:
MCL, {A}KCL, Allegro CL (including Allegro CL\PC), Ibuki, Lucid,
Medley, Symbolics Genera, CLOE, and Harlequin Lispworks. CMU CL uses a
customized version of PCL as their CLOS. However, not all native CLOS
implementations have as detailed a meta-object protocol as PCL. For
example, MCL 2.0 users sometimes use the july-1d version of PCL
instead of the native CLOS for precisely this reason.

The book ``The Art of the Metaobject Protocol'' (see below) includes
the CLOS Metaobject Protocol specification as chapters 5 and 6.  The
sources for the MOP spec itself are available from parcftp as
/pub/pcl/mop/spec.tar.Z, but this is no substitute for buying the
book, since the book contains a lot of useful explanatory material
beyond the spec. The Closette files related to the book are also
available from parcftp as /pub/pcl/mop/closette.lisp.

The CLOS code repository is available by anonymous ftp to
nervous.cis.ohio-state.edu [128.146.61.200] in the directory
pub/lispusers/clos/. If you've got code you'd like to add to the

----------------------------------------------------------------
Subject: [5-1] What documentation is available about object-oriented
               programming in Lisp?

Books about object-oriented programming in Lisp include:

   1. dpANS CL describes the entire Common Lisp language, which includes the
      CLOS standard.  Informally, CLtL2 can also be used to learn about CLOS,
      but please remember that CLtL2 is not an official X3J13 committee
      document. (The presentation of CLtL2 differs from that of the draft
      proposed standard, and some matters of fact have changed in the proposed
      standard since the publication of CLtL2.)

   2. Sonya E. Keene
      "Object-Oriented Programming in Common Lisp:
       A Programmer's Guide to CLOS"
      Addison-Wesley (Reading, MA), 1989. 266 pages. ISBN 0-201-17589-4.
           Tutorial introduction to CLOS with many examples and
           a lot of good advice for designing large programs using CLOS.

   3. Jo A. Lawless and Molly M. Miller.
      "Understanding CLOS: the Common Lisp Object System"
      Digital Press, 1991. 192 pages.

   4. Gregor Kiczales, Jim des Rivieres, and Daniel G. Bobrow.
      "The Art of the Metaobject Protocol"
      MIT Press, 1991. 335 pages. ISBN 0-262-61074-4
           The first part of the book presents a model CLOS implementation,
           introduces the basic principles of metaobject protocols, and
           works through the key elements of the CLOS Metaobject Protocol.
           The second half is the detailed specification of the CLOS
           Metaobject Protocol. A simple working interpreter suitable
           for experimentation is contained in an appendix.

   5. Robert R. Kessler and Amy R. Petajan.
      "LISP, Objects, and Symbolic Programming"
      Scott, Foresman and Company (Glenview, IL), 1988. 644 pages.
           Includes a small Lisp compiler.

   6. A short introduction to CLOS written by Jeff Dalton of the

      anonymous ftp from  
         aiai.ed.ac.uk:/lisp/random [192.41.104.6]
      as the file clos-guide.

   7. Andreas Paepcke
      "Object-Oriented Programming: the CLOS Perspective"
      MIT Press, 1993, ISBN 0-262-16136-2.
         This book is a collection of essays on the following topics:
           -  Description of CLOS and its design philosophy.
           -  The Metaobject Protocol and its use.
           -  Comparison of CLOS with Smalltalk, Eiffel, Sather, and C++.
           -  CLOS Uses and Methodology. Descriptions of two large CLOS
              applications (Sun's LispView and a hybrid knowledge
              representation tool) and an approach to documenting
              object-oriented protocols (similar to that of AMOP).
           -  Implementation details. Descriptions of TI CLOS for the
              Explorer and PCL's method dispatch mechanism.

----------------------------------------------------------------
Subject: [5-2] How can I write a function that can access defstruct slots
               by name?  I would like to write something like
               (STRUCTURE-SLOT <object> '<slot-name>).

There is currently no portable, built-in way to access structure slots
given only the name.  If your Common Lisp includes an implementation
of CLOS that supports the meta-object protocol specified in the
original X3J13 draft spec (document X3J13/88-003), then it probably will
allow (SLOT-VALUE <object> '<slot-name>); however, not all
implementations of CLOS currently provide this.  Lacking this, some
implementations may provide implementation-dependent functions that
allow access to structure slots by name; note that this may cause
saved images to be larger, as some implementations normally open-code
structure accessors and discard slot name information.

While it is not possible to write a fully general STRUCTURE-SLOT function,
it is not very difficult to write version that handles specific structure
types.  For instance, after defining:

   (defstruct spaceship name captain position velocity)

one may then define:

   (defun spaceship-slot (spaceship slot-name)
     (ecase slot-name
       (name (spaceship-name spaceship))
       (captain (spaceship-captain spaceship))
       (position (spaceship-position spaceship))
       (velocity (spaceship-velocity spaceship))))

or using CLOS (generic functions):

(defgeneric spaceship-slot (spaceship slot-name)
  (:method ((x spaceship) (slot (eql :name)))
    (spaceship-name x))
  (:method ((x spaceship) (slot (eql :captain)))
    (spaceship-captain x))
  (:method ((x spaceship) (slot (eql :position)))
    (spaceship-position x))
  (:method ((x spaceship) (slot (eql :velocity)))
    (spaceship-velocity x)))

Another popular way to define this is:

   (defun spaceship-slot (spaceship slot-name)
     (funcall (symbol-function
                (find-symbol (format nil "SPACESHIP-~A" slot-name)
                             #.(package-name *package*)))
              spaceship))

I personally recommend the first version.  It is likely to be much faster
and more memory efficient than the second version.  It's also easy to get
the second one wrong; many people forget to specify the package argument to
FIND-SYMBOL, which can cause incorrect results when the package at run time
is different from the one at compile time.  Even my version assumes that
SPACESHIP-SLOT is being defined in a file that is in the same package as
the one containing the structure definition; if this isn't the case,
#.(PACKAGE-NAME *PACKAGE*) should be replaced by a string naming the
correct package.

Another workaround is to define a MY-DEFSTRUCT macro that parses the
defstruct arguments and expands into a call to DEFSTRUCT along with a
definition of the runtime slot-accessor function.

Some non-portable techniques include the use of SYSTEM:STRUCTURE-REF
in Lucid (LCL:STRUCTURE-REF in earlier versions of Lucid) and
EXCL:STRUCTURE-REF in Allegro.
----------------------------------------------------------------
Subject: [5-3] How can I list all the CLOS instances in a class?

There is no built-in way to enumerate the instances of a class.  If you are
only interested in listing the instances of classes that you have defined,
it is not ...

read more »



Thu, 01 Aug 1996 16:01:40 GMT  
 FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]
Archive-name: lisp-faq/part6
Last-Modified: Mon Jan 17 14:48:52 1994 by Mark Kantrowitz
Version: 1.42

;;; ****************************************************************
;;; FTP Archives and Other Resources *******************************
;;; ****************************************************************
;;; Written by Mark Kantrowitz and Barry Margolin
;;; lisp_6.faq -- 66367 bytes

This post contains Part 6 of the Lisp FAQ.

If you think of questions that are appropriate for this FAQ, or would

Topics Covered (Part 6):
  [6-0] General information about FTP Resources for Lisp
  [6-1] Repositories of Lisp Software
  [6-3] Publicly Redistributable Lisp Software
  [6-6] Formatting code in{*filter*}
  [6-7] Where can I get an implementation of Prolog in Lisp?

Search for \[#\] to get to question number # quickly.

----------------------------------------------------------------
Subject: [6-0] General information about FTP Resources for Lisp

Remember, when ftping compressed or compacted files (.Z, .z, .arc, .fit,
etc.) to use binary mode for retrieving the files.

Files that end with a .z suffix were compressed with the patent-free
gzip (no relation to zip). Source for gzip is available from:
   prep.ai.mit.edu:pub/gnu/{gzip-1.0.7.shar,gzip-1.0.7.tar}

FTP sites for Lisp and Scheme interpreters and compilers are discussed
in the answer to questions [4-0] and [4-2] and in the Scheme FAQ. See
the entry on Macintosh Common Lisp in question [4-1] for information
on the CD-ROM of Lisp code that Apple distributes with MCL 2.0.

----------------------------------------------------------------
Subject: [6-1] Repositories of Lisp Software

There are several repositories of publicly redistributable and
public domain Lisp code.

   The Lisp Utilities collection is accessible by anonymous ftp
   to any CMU CS machine (e.g., ftp.cs.cmu.edu [128.2.206.173])
   or through AFS in the directory
      /afs/cs.cmu.edu/project/ai-repository/ai/lang/lisp/
   If accessing this directory through anonymous ftp, it is
   important to "cd" to the directory using one atomic operation, as
   some of the superior directories on the path are protected from
   access by an anonymous ftp.
   Files included in the repository include:
      extensions.lisp         A collection of extensions to Common Lisp.
      initializations.lisp    Brad Miller's initializations packaged
                              for Allegro CL 4.0.
      xref.lisp               Portable cross referencing tool for Lisp.
                              Similar to the Symbolics Who-Calls and
                              the Xerox MasterScope programs.
      defsystem.lisp          Portable system definition facility (a
                              "Make" for lisp). More featureful than
                              other defsystem implementations.
      logical-pathnames.lisp  Portable implementation of the X3J13
                              June 1989 specification for logical pathnames.
      metering.lisp           Portable code time/space profiling tool.
      source-compare.lisp     A portable "diff" utility for Lisp.
      user-manual.lisp        Program which helps with documenting Lisp code.
      psgraph.lisp            Joe Bates' postscript DAG grapher.
      matcher.lisp            A regexp-like matcher for Lisp.
      framework.lisp          A portable generic frame system.
      date-formatter.lisp     Simple code for formatting a date.
      infix.lisp              Infix reader macro for Lisp.
      save-object.lisp        Kerry Koitzsch's package to save ASCII
                              representations of Lisp objects to a file.
      defpackage.lisp         Stephen Nicoud's semi-portable
                              CLtL2 version of defpackage.
      lalr.lisp               Mark Johnson's lisp YACC parser generator.
      ops5.tar.Z              Public domain Common Lisp implementation
                              of the OPS5 production system interpreter.
                              "Expert System Shell".
                              Written by Charles F{*filter*} and ported by
                              George Wood and Jim Kowalski.
      cmu-loop.lisp           Implements the CLtL2 Loop Macro.
      mit-loop.lisp           Implements the CLtL1 Loop Macro.
      sloop.lisp              William Schelter's loop macro, not CLtL1/2.
      yloop.lisp              Frank Ritter and Jim Panagos' implementation
                              of the Yale loop macro described in
                              McDermont, Charniak and Riesbeck's
                              AI programming book. Not CLtL1/2.
      ew/                     Express Windows distribution.
      iterate/                The Iterate Macro.
      series/                 Waters' Series Macro package.
      xp.tar.Z                Waters' XP Lisp Pretty Printer
      simplex.lisp            Bruno Haible's implementation of the Simplex
                              algorithm.
      mapforms.tar.Z          Moon's code walker.
      resources.lisp          Brad Miller's resources package.
      nregex.lisp             Lawrence Freil's regular expression matching code
   The Lisp Utilities repository is maintained by Mark Kantrowitz,

   The CLOS code repository is available by anonymous ftp to
   nervous.cis.ohio-state.edu [128.146.61.200] in the directory
   pub/lispusers/clos/. If you've got code you'd like to add to the

   The CLOS code repository includes dag.lisp.Z and 3DGeometry.lisp.
   [The AI Repository's Lisp Section includes a directory of CLOS code
   as well, in ftp.cs.cmu.edu:user/ai/lang/lisp/oop/clos-code/.]

   The Macintosh Common Lisp repository contains Lisp code for
   MCL contributed by MCL users. It is available by anonymous ftp from
   cambridge.apple.com:pub/MCL2/CONTRIB/       [134.149.2.3]
   and also contains the Info-MCL mailing list archives. The
   repository contains, among other things, AV_Parser.hqx and Zebu
   (general parser toolkits), babylon-2.2.sit.hqx (expert system shell
   from GMD in Germany), btree.sit.hqx (binary trees), LGL.lisp (Lisp
   Graphics Library for MCL), quicktime code, mmlisp.sit.hqx
   (midi-manager interface), tips on optimizing MCL code, PARKA.sit.hqx
   (a knowledge representation system), starsim.sit.hqx (*Lisp for MCL),
   IP/TCP examples, and support for hypercard XCMDs and XFCNs.  See the
   file README for a quick overview of the contents of the MCL
   repository.

   The CLIM Library (a library of user contributed code for the CLIM
   environment) is available by anonymous ftp on
      cambridge.apple.com:/pub/clim [134.149.2.3]
   For information on CLIM, see the entry in [6-5] below.  For more

   MIT AI Lab -- ftp.ai.mit.edu:pub/
      loop-macro.tar               [LOOP from CLtL1]
      series/                      [SERIES from CLtL2; older version]
      Iterate/                     [Alternative to series and loop.]
      clmath.tar                   [Numeric math 1984]
      ontic/                       [ONTIC Knowledge Rep. for Mathematics]
   clmath is a Lisp library of mathematical functions that calculate
   hyperbolic and inverse hyperbolic functions, Bessel functions,
   elliptic integrals, the gamma and beta functions, and the incomplete
   gamma and beta functions.  There are probability density functions,
   cumulative distributions, and random number generators for the normal,
   Poisson, chi-square, Student's T, and Snedecor's F functions. Discrete
   Fourier Transforms. Multiple linear regression, Fletcher-Powell
   unconstrained minimization, numerical integration, root finding,
   and convergence. Code to factor numbers and to do the
   Solovay-Strassen probabilistic prime test is included.
   A technical report describing CLMath is available as MIT AI Lab
   Memo 774, Gerald Roylance, "Some Scientific Subroutines in LISP",
   September 1984. Iterate is Jonathan Amsterdam's alternative to

   The LispUsers Archives, a collection of programs for Medley, can be
   found on nervous.cis.ohio-state.edu:pub/lispusers/medley. The files
   include a plotting module, addressbook, chat program, clock,
   call-grapher, grep implementation, Tower of Hanoi, Life, lisp dialect
   translator, and fonts. Also on nervous.cis.ohio-state.edu is GTT, an
   implementation of Chandrasekaran's Generic Tasks Toolset, in directory
   pub/lispusers/toolset.

   There's a repository of Amiga LISP implementations (and other Lisp-like
   language implementations) on gatekeeper.pa.dec.com:pub/micro/amiga/lisp/.

   Common Lisp versions of the mini programs from "Inside Computer
   Understanding" by Schank and Riesbeck, 1981, are available by
   anonymous ftp from cs.umd.edu in the directory pub/schank/icu. This
   includes the SAM and ELI miniatures. It will eventually include copies
   of the miniature versions of PAM, POLITICS, and Tale-Spin. The FOR
   macro is also available in this directory, as are a set of functions
   for manipulating and matching lisp representations of Conceptual

   more information.

   Norvig:
   The software from Peter Norvig's book "Paradigms of AI Programming" is
   available by anonymous ftp from unix.sri.com:pub/norvig and on disk in
   Macintosh or DOS format from the publisher, Morgan Kaufmann.
   |
   Software includes Common Lisp implementations of:
      Eliza and pattern matchers, Emycin, Othello, Parsers,
      Scheme interpreters and compilers, Unification and a prolog
      interpreter and compiler, Waltz line-labelling,
      implementation of GPS, macsyma, and random number
...

read more »



Thu, 01 Aug 1996 16:01:51 GMT  
 FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]
Archive-name: lisp-faq/part7
Last-Modified: Mon Jan 17 14:49:02 1994 by Mark Kantrowitz
Version: 1.42

;;; ****************************************************************
;;; Lisp Window Systems and GUIs ***********************************
;;; ****************************************************************
;;; Written by Mark Kantrowitz and Barry Margolin
;;; lisp_7.faq -- 12294 bytes

This post contains Part 7 of the Lisp FAQ.

If you think of questions that are appropriate for this FAQ, or would

Topics Covered (Part 7):
  [7-1] How can I use the X Window System or other GUIs from Lisp?
  [7-2] What Graphers/Browsers are available?

Search for \[#\] to get to question number # quickly.
----------------------------------------------------------------
Subject: [7-1] How can I use the X Window System or other GUIs from Lisp?

There are several GUI's and Lisp interfaces to the X Window System. Mailing
lists for these systems are listed in the answer to question [4-7].
Various vendors also offer their own interface-building packages.

   CLX provides basic Common Lisp/X functionality. It is a de facto standard
   low-level interface to X, providing equivalent functionality to XLib, but
   in Lisp. It is also a good source for comparing the foreign function calls
   in various Lisps. Does *not* depend on CLOS.  Available free as part of the
   X release in the contrib directory.  Also available from
   ftp.x.org:/contrib (formerly export.lcs.mit.edu) as the files
   CLX.Manual.tar.Z and CLX.R5.02.tar.Z.


   The 232 page manual is available in /pub/R5untarred/mit/hardcopy/CLX
   (PostScript format) and /pub/R5untarred/mit/doc/CLX (Interleaf source).

   CLIM (Common Lisp Interface Manager) is a portable, graphical user
   interface toolkit originally developed by International Lisp
   Associates, Symbolics, and Xerox PARC, and now under joint development
   by several Lisp vendors, including Symbolics, Franz, Lucid, Illudium,
   and Harlequin.  It is intended to be a portable successor of Symbolics
   UIMS (Dynamic Windows, Presentations Types).  CLIM 2.0 also supports
   more traditional toolkit-style programming.  It runs on Symbolics Lisp
   Machines; Allegro, Lucid, and Harlequin on several Unix platforms;
   Symbolics CLOE on 386/486 IBM PCs running Windows; and MCL on Apple
   Macintoshes.  It is *not* free, and with the exception of
   Macintoshes, if it is available it can be purchased from the vendor
   of the Lisp system you are using.  For the Macintosh version write
   to Illudium:


   Illidium has signed a distribution agreement for MCL CLIM with

   415-329-8400. (Lucid also has a license to distribute MCL itself.)
   CLIM includes a general purpose grapher. The CLIM 2.0 SPECIFICATION
   is available by anonymous ftp from ftp.uu.net:vendor/franz/clim/clim.ps.Z.

   CLUE (Common Lisp User-Interface Environment) is from TI, and extends CLX
   to provide a simple, object-oriented toolkit (like Xt) library that uses
   CLOS. Provides basic window classes, some stream I/O facilities, and a few
   other utilities. Still pretty low level (it's a toolkit, not widget
   library).  Available free by anonymous ftp from csc.ti.com:pub/clue.tar.Z

   CLIO (Common Lisp Interactive Objects) is a GUI from the people who created
   CLUE. It provides a set of CLOS classes that represent the standard
   components of an object-oriented user interface -- such as text, menus,
   buttons, scroller, and dialogs.  It is included as part of the CLUE
   distribution, along with some packages that use it, both sample and real.

   Allegro Common Windows provides a front end to CLX. Uses CLOS.

   [Intellicorp's KEE4.0 comes with Common Windows also. They've
    implemented the CW spec to run on Lucid 4.0 on Sparcs, HP300/400s,

    information.]

   The LispWorks Toolkit is an extensible CLOS-based widget set that uses
   CLX and CLUE. The LispWorks programming environment has been written
   using the toolkit and includes: an Emacs-like editor, listener,
   de{*filter*}, profiler, and operating system shell; browsers/graphers for
   classes, generic functions, processes, windows, files, compilation
   errors, source code systems, and setting LispWorks parameters; and an
   interactive interface builder and complete online hypertext

   CLM (Common Lisp Motif) and GINA (Generic Interactive Application) and
   IB (Interface Builder). CLM runs Motif widgets in a separate C
   process, with minimal work on the Lisp side and communicates between C
   and Lisp using TCP sockets. Runs in Allegro CL, Sun CL, CMU CL, Lucid
   CL, and Symbolics Genera. GINA uses CLOS.  Available free in the X
   contrib directory or by anonymous ftp from either
      ftp.x.org:/contrib (formerly export.lcs.mit.edu) or
      ftp.gmd.de:/gmd/gina [129.26.8.90]
   as the files CLM+GINA.README, CLM2.2.tar.Z and GINA2.2.tar.Z.  CLM was


   Contact Mike Spenke for more info. To be added to the mailing list,

   EW (Express Windows) is intended to mimic Symbolics' Dynamic Windows user
   and programmer interfaces. It is available free in the ew/ subdirectory of
   the Lisp Utilities repository.  It is no longer under active development.
   Runs on Sun/Lucid, Franz Allegro, and Symbolics. Should port easily to
   other Lisps with CLX.

   Garnet is a large and flexible GUI. Lots of high-level features.  Does
   *not* depend on CLOS, but does depend on CLX. Garnet (version 2.0 and
   after) is now in the public domain, and has no licensing restrictions,
   so it is available to all foreign sites and for commercial uses.
   Detailed instructions for obtaining it by anonymous ftp are available
   by anonymous ftp from a.gp.cs.cmu.edu [128.2.242.7] as the file
   /usr/garnet/garnet/README.  Garnet includes the Lapidiary interactive
   design tool, C32 constraint editor, spreadsheet object, Gilt
   Interface Builder, automatic display management, two
   widget sets (Motif look-and-feel and Garnet look-and-feel), support for
   gesture recognition, and automatic constraint maintenance, application
   data layout and PostScript generation. Runs in virtually any Common
   Lisp environment, including Allegro, Lucid, CMU, and Harlequin Common
   Lisps on Sun, DEC, HP, Apollo, IBM 6000, and many other machines.
   Garnet helps implement highly-interactive, graphical, direct
   manipulation programs for X/11 in Common Lisp.  Typical applications
   include: drawing programs similar to Macintosh MacDraw, user interfaces
   for expert systems and other AI applications, box and arrow diagram
   editors, graphical programming languages, game user interfaces,
   simulation and process monitoring programs, user interface construction





   those without access to netnews).

   LispView is a GUI written at Sun that does not use CLX.  Instead it
   converts Xlib.h directly into Lucid foreign function calls. It is intended
   to be fast and tight. Uses CLOS.  Available for anonymous ftp from
      ftp.x.org:contrib/lispview1.1 (formerly export.lcs.mit.edu) and
      xview.ucdavis.edu:pub/XView/LispView1.1
   Includes a general-purpose 2D grapher library.


   WINTERP (Widget INTERPreter) was developed at HP and uses the Xtoolkit and
   Motif widget set. It is based on David Betz's XLISP interpreter, which is a
   small subset of Common Lisp that runs on IBM PCs. Runs on DecStation 3100,
   HP9000s, Sun3, Sparcs.  It is a free-standing Lisp-based tool for setting
   up window applications. Available free in X contrib directory, or by
   anonymous ftp from ftp.x.org:contrib/winterp-???.tar.Z (formerly
   export.lcs.mit.edu) where ??? is the version number.  If you do not
   have Internet access you may request the source code to be mailed


   YYonX is a port of the YY system to X windows. Runs in Lucid CL, Allegro
   CL, and Symbolics Genera. Supports kanjii.  Developed at Aoyama Gakuin
   University. Available free by anonymous ftp from ftp.csrl.aoyama.ac.jp:YY/

   Picasso is a CLOS based GUI, and is available from
      postgres.berkeley.edu:/pub/Picasso-2.0
      toe.cs.berkeley.edu:pub/picasso/
   It runs on DecStation 3100s, Sun3 (SunOs), Sun4 (Sparc), and Sequent
   Symmetry in Allegro CL. The file pub/xcl.tar.Z contains X-Common Lisp

   more information. [Picasso is no longer an
...

read more »



Thu, 01 Aug 1996 16:02:07 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. FAQ: Lisp Frequently Asked Questions 2/7 [Monthly posting]

2. FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]

3. FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]

4. FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]

5. FAQ: Lisp Frequently Asked Questions 3/7 [Monthly posting]

6. FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]

7. FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]

8. FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]

9. FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]

10. FAQ: Lisp Frequently Asked Questions 2/7 [Monthly posting]

11. FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]

12. FAQ: Lisp Frequently Asked Questions 1/7 [Monthly posting]

 

 
Powered by phpBB® Forum Software