home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / lisp / 2216 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  62.8 KB

  1. Xref: sparky comp.lang.lisp:2216 news.answers:2477
  2. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!ogicse!das-news.harvard.edu!cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!mkant
  3. From: mkant+@cs.cmu.edu (Mark Kantrowitz)
  4. Newsgroups: comp.lang.lisp,news.answers
  5. Subject: FAQ: Lisp Frequently Asked Questions 2/5 [Monthly posting]
  6. Summary: Frequently asked questions about Lisp -- General Questions
  7. Message-ID: <lisp-faq-2.text_713752657@cs.cmu.edu>
  8. Date: 14 Aug 92 00:38:07 GMT
  9. Article-I.D.: cs.lisp-faq-2.text_713752657
  10. Expires: Sun, 27 Sep 1992 00:37:37 GMT
  11. Sender: news@cs.cmu.edu (Usenet News System)
  12. Reply-To: lisp-faq@think.com
  13. Followup-To: poster
  14. Organization: School of Computer Science, Carnegie Mellon
  15. Lines: 1215
  16. Approved: news-answers-request@MIT.Edu
  17. Supersedes: <lisp-faq-2.text_711014487@cs.cmu.edu>
  18. Nntp-Posting-Host: a.gp.cs.cmu.edu
  19.  
  20. Archive-name: lisp-faq/part2
  21. Last-Modified: Thu Aug  6 11:54:55 1992 by Mark Kantrowitz
  22. Version: 1.23
  23.  
  24. ;;; ****************************************************************
  25. ;;; Answers to Frequently Asked Questions about Lisp ***************
  26. ;;; ****************************************************************
  27. ;;; Written by Mark Kantrowitz and Barry Margolin
  28. ;;; lisp-faq-2.text -- 63485 bytes
  29.  
  30. This post contains Part 2 of the Lisp FAQ.
  31.  
  32. If you think of questions that are appropriate for this FAQ, or would
  33. like to improve an answer, please send email to us at lisp-faq@think.com.
  34.  
  35. Topics Covered (Part 2):
  36.  
  37.   [2-0]   What FTP resources are available?
  38.   [2-1]   Is there a GNU-Emacs interface to Lisp?
  39.   [2-2]   How can I use the X Window System or other GUIs from Lisp?
  40.   [2-3]   When is it right to use EVAL?
  41.   [2-4]   What is the equivalent of EXPLODE and IMPLODE in Common Lisp?
  42.   [2-5]   Is Lisp inherently slower than more conventional languages such as C?
  43.   [2-6]   Why does my program's behavior change each time I use it?
  44.   [2-7]   Why does Common Lisp have "#'"?
  45.   [2-8]   How do I call non-Lisp functions from Lisp?
  46.   [2-9]   Can I call Lisp functions from other languages?
  47.   [2-10]  I want to call a function in a package that might not exist at
  48.           compile time. How do I do this?  
  49.   [2-11]  What is CDR-coding?
  50.   [2-12]  What is garbage collection?
  51.   [2-13]  How do I save an executable image of my loaded Lisp system?
  52.           How do I run a Unix command in my Lisp?
  53.           How do I get the current directory name from within a Lisp program?
  54.   [2-14]  I'm porting some code from a Symbolics Lisp machine to some
  55.           other platform, and there are strange characters in the code.
  56.           What do they mean?  
  57.   [2-15]  History: Where did Lisp come from?
  58.   [2-16]  How do I find the argument list of a function?
  59.   [2-17]  How can I have two Lisp processes communicate via unix sockets?
  60.   [2-18]  When producing formatted output in Lisp, where should you put the
  61.           newlines (e.g., before or after the line, FRESH-LINE vs TERPRI,
  62.           ~& vs ~% in FORMAT)?
  63.  
  64. Search for [#] to get to question number # quickly.
  65.  
  66. ----------------------------------------------------------------
  67. [2-0] What FTP resources are available?
  68.  
  69. There are several repositories of publicly redistributable and
  70. public domain Lisp and Scheme code. 
  71.  
  72. FTP sites for Lisp/Scheme interpreters and compilers are discussed in
  73. the answer to question [4-0]. See the entry on Macintosh Common Lisp
  74. in question [4-0] for information on the CD-ROM of Lisp code that
  75. Apple distributes with MCL 2.0.
  76.  
  77.    The Lisp Utilities collection is accessible by anonymous ftp
  78.    to any CMU CS machine (e.g., ftp.cs.cmu.edu [128.2.206.173])
  79.    or through AFS in the directory
  80.            /afs/cs.cmu.edu/user/mkant/Public/Lisp-Utilities/
  81.    If accessing this directory through anonymous ftp, it is 
  82.    important to "cd" to the directory using one atomic operation, as
  83.    some of the superior directories on the path are protected from
  84.    access by an anonymous ftp.
  85.    Files included in the repository include:
  86.       extensions.lisp         A collection of extensions to Common Lisp.
  87.       initializations.lisp    Brad Miller's initializations packaged
  88.                               for Allegro CL 4.0.
  89.       xref.lisp               Portable cross referencing tool for Lisp.
  90.                               Similar to the Symbolics Who-Calls and
  91.                               the Xerox MasterScope programs.
  92.       defsystem.lisp          Portable system definition facility (a
  93.                               "Make" for lisp). More featureful than
  94.                               other defsystem implementations.
  95.       logical-pathnames.lisp  Portable implementation of the X3J13
  96.                               June 1989 specification for logical pathnames. 
  97.       metering.lisp           Portable code time/space profiling tool.
  98.       source-compare.lisp     A portable "diff" utility for Lisp.
  99.       user-manual.lisp        Program which helps with documenting Lisp code.
  100.       psgraph.lisp            Joe Bates' PostScript DAG grapher.
  101.       matcher.lisp            A regexp-like matcher for Lisp.
  102.       framework.lisp          A portable generic frame system.
  103.       date-formatter.lisp     Simple code for formatting a date.
  104.       save-object.lisp        Kerry Koitzsch's package to save ASCII
  105.                               representations of Lisp objects to a file. 
  106.       defpackage.lisp         Stephen Nicoud's semi-portable
  107.                               CLtL2 version of defpackage. 
  108.       johnson-yacc.lisp       Mark Johnson's lisp YACC.
  109.       ops5.tar.Z              Public domain Common Lisp implementation 
  110.                               of the OPS5 production system interpreter.
  111.                               "Expert System Shell".
  112.                               Written by Charles Forgy and ported by
  113.                               George Wood and Jim Kowalski.
  114.       cmu-loop.lisp           Implements the CLtL2 Loop Macro.
  115.       mit-loop.lisp           Implements the CLtL1 Loop Macro.
  116.       sloop.lisp              William Schelter's loop macro, not CLtL.
  117.       yloop.lisp              Frank Ritter and Jim Panagos' implementation
  118.                               of the Yale loop macro described in
  119.                               McDermont, Charniak and Riesbeck's
  120.                               AI programming book. Not CLtL.
  121.       ew/                     Express Windows distribution.
  122.       iterate/                The Iterate Macro.
  123.       series/                 Waters' Series Macro package.
  124.       simplex.lisp            Bruno Haible's implementation of the Simplex
  125.                               algorithm.
  126.       mapforms.tar.Z          Moon's code walker.
  127.       resources.lisp          Brad Miller's resources package.
  128.       nregex.lisp          Lawrence Freil's regular expression matching code
  129.    The Lisp Utilities repository is maintained by Mark Kantrowitz,
  130.    cl-utilities-request@cs.cmu.edu.
  131.  
  132.    The Scheme Repository contains a Scheme bibliography, copies
  133.    of the R4RS report and other papers, sample Scheme code for a variety of
  134.    purposes, several utilities, and some implementations. The
  135.    repository is maintained by Ozan S. Yigit, scheme@nexus.yorku.ca.
  136.    The repository is accessible by anonymous ftp at
  137.    nexus.yorku.ca [130.63.9.66] in the directory pub/scheme/.
  138.  
  139.    Scheme Implementations may also be found at altdorf.ai.mit.edu:/archive/ 
  140.    The R4RS reports is available in altdorf.ai.mit.edu:/archive/scheme-reports/
  141.    or as MIT AI Memo 848b (email publications@ai.mit.edu for more information).
  142.  
  143.    PSD (Portable Scheme Debugger) is available by anonymous ftp
  144.    from Tampere University of Technology, Finland,
  145.       cs.tut.fi:/pub/src/languages/schemes/psd.tar.Z
  146.    With PSD, you can run a Scheme program in an Emacs buffer, set
  147.    breakpoints, single step evaluation and access and modify the
  148.    program's variables. It works by instrumenting the original source
  149.    code, so it should run with any R4RS compliant Scheme. It has been
  150.    tested with SCM and Elk 1.5, but should work with other Schemes with a
  151.    minimal amount of porting, if at all. Includes documentation and
  152.    user's manual. Written by Pertti Kellom\"aki, pk@cs.tut.fi
  153.  
  154.    The Macintosh Common Lisp repository contains Lisp code for
  155.    MCL contributed by MCL users. It is available by anonymous ftp from
  156.    cambridge.apple.com:pub/MACL/CONTRIB       [134.149.2.3]
  157.    and also contains the Info-MCL mailing list archives.
  158.  
  159.    MIT AI Lab -- ftp.ai.mit.edu:pub/
  160.       loop-macro.tar               [LOOP from CLtL]
  161.       series/                      [SERIES from CLtL2]
  162.       Iterate/                     [Alternative to series and loop.]
  163.       clmath.tar                   [Numeric math 1984]
  164.       ontic/               [ONTIC Knowledge Rep. for Mathematics]
  165.       xp/                          [Waters' XP Lisp Pretty Printer]
  166.  
  167.    The LispUsers Archives, a collection of programs for Medley, can be
  168.    found on nervous.cis.ohio-state.edu:pub/lispusers/medley. Also on
  169.    nervous.cis.ohio-state.edu is GTT, an implementation of Chandrasekaran's
  170.    Generic Tasks Toolset, in directory pub/lispusers/toolset.
  171.  
  172.    There's a repository of Amiga LISP (and Lisp-like language)
  173.    implementations on gatekeeper.pa.dec.com:pub/micro/amiga/lisp/.
  174.  
  175.    Common Lisp versions of the mini programs from "Inside Computer
  176.    Understanding" by Schank and Riesbeck, 1981, are available by anonymous ftp
  177.    from cs.umd.edu in the directory pub/schank. Contact Bill Andersen
  178.    (waander@cs.umd.edu) for more information. The directory pub/schank/icbr
  179.    contains the complete code for "Inside Case-Based Reasoning" by Riesbeck
  180.    and Schank, 1989. This includes code for an instructional version
  181.    of CHEF by Kristian Hammond.
  182.  
  183.    Norvig:
  184.    The software from Peter Norvig's book "Paradigms of AI Programming" is
  185.    available by anonymous ftp from unix.sri.com:pub/norvig and on disk in
  186.    Macintosh or DOS format from the publisher, Morgan Kaufmann.
  187.    |
  188.    Software includes Common Lisp implementations of:
  189.       Eliza and pattern matchers, Emycin, Othello, Parsers,
  190.       Scheme interpreters and compilers, Unification and a prolog
  191.       interpreter and compiler, Waltz line-labelling,
  192.       implementation of GPS, macsyma, and random number generators.
  193.    |
  194.    For more information, contact:
  195.            Morgan Kaufmann, Dept. P1, 2929 Campus Drive, Suite 260
  196.            San Mateo CA 94403, (800) 745-7323; FAX: (415) 578-0672
  197.  
  198.    A catalog of free and commercial natural language software
  199.    is available from the Natural Language Software Registry,
  200.    by anonymous ftp from tira.uchicago.edu [128.135.96.31] in
  201.    the directory /registry, or by email to registry@tira.uchicago.edu.
  202.  
  203.  Other sites contain specific programs:
  204.  
  205.    PCL -- parcftp.xerox.com:pcl/ [13.1.64.94]
  206.    Portable Common Loops (PCL) is a portable implementation of
  207.    the Common Lisp Object System (CLOS).
  208.  
  209.    Gabriel Lisp Benchmarks are available by anonymous ftp as
  210.    ai.toronto.edu:/pub/gabriel-lisp-benchmarks.tar.Z.
  211.  
  212.    GLisp -- apple.com:/pub/dts/mac/lisp/glisp.tar.Z
  213.    See also ftp.apple.com
  214.    
  215.    OBVIUS -- whitechapel.media.mit.edu:/pub/ [18.85.0.125]
  216.    Object-Based Vision and Image Understanding System (OBVIUS), is a Common
  217.    Lisp image processing package. Provides a library of image processing
  218.    routines (e.g., convolutions, fourier transforms, statistical
  219.    computations, etc.) on gray or binary images and image-sequences (no
  220.    color support yet), an X windows display interface, postscript printer
  221.    output, etc.  It uses a homebrew interface to X11 (i.e., it does not use
  222.    clx or clue). However, they eventually hope to port Obvius to a clx/clue
  223.    platform. Written by David Heeger <heeger@white.stanford.edu> and Eero
  224.    Simoncelli <eero@whitechapel.media.mit.edu>. Runs in Lucid-4.0. Includes
  225.    LaTeX documentation and User's Guide.
  226.    
  227.    Scheme Utilities -- brokaw.lcs.mit.edu:/pub/scmutils.tar  18.30.0.33
  228.  
  229.    GNU-Emacs -- prep.ai.mit.edu:
  230.  
  231.    TI Explorer Lisp Code -- sumex-aim.stanford.edu:pub/exp/
  232.    The Knowledge Systems Lab's set of Explorer patches and tools. It
  233.    includes in the jwz subdirectory a set of tools written and collected
  234.    by Jamie Zawinski. Send questions to acuff@sumex-aim.stanford.edu.
  235.  
  236.    StarLisp Simulator -- think.com:/cm/starlisp/starsim-f19-sharfile
  237.    Simulates *Lisp, one of the programming langauges used to program
  238.    the Connection Machine. Runs under Symbolics, Lucid, Allegro, and Franz.
  239.  
  240.    InterLisp->Common-Lisp Translator -- ai.sri.com:pub/pkarp/lisp/ilisp/
  241.  
  242.    MCS (Meta Class System) -- ftp.gmd.de:/pub/lisp/mcs/ [129.26.8.90]
  243.    Portable object-oriented extension to Common Lisp. Integrates the
  244.    functionality of CLOS (the Common Lisp Object System), and TELOS, (the
  245.    object system of LeLisp Version 16 and EULISP).  MCS provides a metaobject
  246.    protocol which the user can specialize.  MCS is claimed to be more
  247.    efficient in time and space than comparable systems we know, including
  248.    commercial CLOS implementations. Runs in any valid Common Lisp.
  249.    Contact: Harry Bretthauer and Juergen Kopp, German National Research
  250.    Center for Computer Science (GMD), Expert System Research Group,
  251.    P.O. Box 1316, D-5205 Sankt Augustin 1, FRG, email: kopp@gmdzi.gmd.de
  252.  
  253.    LMath -- peoplesparc.berkeley.edu:pub/mma.tar.Z       [128.32.131.14]
  254.    A Mathematica-style parser written in Common Lisp. Written by Richard
  255.    Fateman; fateman@renoir.Berkeley.EDU. Runs in any valid Common Lisp.
  256.  
  257.    CLOS-on-KEE -- zaphod.lanl.gov:/pub/
  258.    A subset of CLOS that is implemented on top of KEE. Contact
  259.    egdorf%zaphod@LANL.GOV (Skip Egdorf) for more info.
  260.    
  261.    ftp.csrl.aoyama.ac.jp:
  262.            YY/     YY window toolkit sources
  263.            Lisp/   several common lisp sources, including MIT's FRL.
  264.  
  265.    RRL (Rewrite Rule Laboratory) -- herky.cs.uiowa.edu:public/rrl
  266.    [128.255.28.100]
  267.  
  268.    TMYCIN -- sumex-aix.stanford.edu:/tmycin  The TMYCIN rule based system.
  269.  
  270.    NONLIN -- cs.umd.edu:/pub/nonlin (128.8.128.8)
  271.    Common Lisp implementation of the NONLIN planning system originally
  272.    designed and implemented by Austin Tate. Bugs can be reported to
  273.    nonlin-bugs@cs.umd.edu. User's group is nonlin-users@cs.umd.edu.
  274.    The authors request that anybody ftping the code send a message to
  275.    nonlin-users-request@cs.umd.edu, letting them know you have a copy
  276.    and also letting them know if you wish to subscribe to the users group.
  277.    More information can also be obtained from Jim Hendler, hendler@cs.umd.edu.
  278.  
  279.    rascal.ics.utexas.edu:/pub/             128.83.138.20
  280.       Maxima for Common Lisp (License required from National
  281.       Energy Software Center at Argonne.) Ported by Bill Schelter.
  282.  
  283.       nqthm/               Boyer and Moore's theorem prover.
  284.                            Also available from cli.com:/pub/nqthm.
  285.       proof-checker/       Matt Kaufmann's proof checking
  286.                            enhancements to nqthm.
  287.  
  288.    Eliza and similar programs. Besides Norvig's book, see:
  289.       o  The doctor.el is an implementation of Eliza for
  290.          GNU-Emacs emacs-lisp. Invoke it with "Meta-X doctor"
  291.       o  Source code for ELIZA in Prolog (implemented by Viren
  292.          Patel) is available by ftp from aisun1.ai.uga.edu.
  293.       o  muLISP-87 (a MSDOS Lisp sold by Soft Warehouse) includes
  294.          a Lisp implementation of Eliza.
  295.       o  Compute!'s Gazette, June 1984, includes source for a
  296.          BASIC implementation of Eliza. You can also find it
  297.          in 101 more computer games, edited by David Ahl,
  298.          published by Creative Computing (alas, they're defunct,
  299.          and the book is out of print).
  300.       o  Herbert Schildt "Artificial Intelligence using C", 
  301.          McGraw-Hill, 1987, ISBN 0-07-881255-0, pp315-338,
  302.          includes a simple version of DOCTOR. 
  303.       o  ucsd.edu:pub/pc-ai contains implementations of Eliza 
  304.          for the IBM PC.
  305.  
  306.    BELIEF is a Common Lisp implementation of the Dempster and
  307.    Kong fusion and propagation algorithm for Graphical Belief
  308.    Function Models and the Lauritzen and Spiegelhalter algorithm 
  309.    for Graphical Probabilistic Models. It is available by
  310.    anonymous ftp from ftp.stat.washington.edu (128.95.17.34),
  311.    and by email from the author, Russell Almond <almond@stat.washington.edu>.
  312.  
  313.    A Common Lisp implementation of ABTWEAK, a hierarchical nonlinear 
  314.    planner extending David Chapman's (MIT) TWEAK, may be obtained by
  315.    anonymous ftp from csis.dit.csiro.au in the directory pub/steve. A
  316.    user's manual, a copy of the associated masters thesis by Steve
  317.    Woods, and an extended Journal paper are also contained in that
  318.    directory. Send mail to Steven.Woods@csis.dit.csiro.au for more
  319.    information.  
  320.  
  321.    PLisp - A Common Lisp front end to Postscript. This translates many
  322.    Common Lisp functions to postscript as well as manage the environment
  323.    and many lispisms (&optional and &rest arguments, multiple values,
  324.    macros, ...).  Available via anonymous ftp in pub/plisp/plisp.tar.Z on
  325.    nebula.cs.yale.edu (128.36.13.1). Written by John Peterson,
  326.    peterson-john@cs.yale.edu.
  327.  
  328.    Frame Languages:
  329.       o  FrameWork is available in the Lisp Utilities Repository 
  330.          described above. 
  331.       o  Theo (learning frame system) is available free from CMU, after
  332.          signing a license agreement. Send mail to Tom.Mitchell@cs.cmu.edu.
  333.       o  FrameKit is available free from CMU, after signing a
  334.          license agreement. Send mail to Eric.Nyberg@cs.cmu.edu
  335.       o  KR. Send mail to Brad.Myers@cs.cmu.edu for more info.
  336.       o  PARMENIDES (Frulekit) is available free, after signing
  337.          a license agreement. Send mail to peter.shell@cs.cmu.edu 
  338.       o  FROBS is available free by anonymous ftp from
  339.          cs.utah.edu:/pub/frobs.tar.Z
  340.          Contact Robert Kessler <kessler@cs.utah.edu> for more info.
  341.       o  PFC is a simple frame system written by Tim Finin
  342.          available free by anonymous ftp from linc.cis.upenn.edu.
  343.       o  YAK is a hybrid knowledge-representation system of the
  344.      KL-ONE family. Includes an optional graphical interface
  345.      depending on the Lisp. Available free after signing a license 
  346.      agreement. Contact Enrico Franconi <franconi@irst.it>.
  347.  
  348.    The UMass GBB system (V1.2) is available by anonymous ftp from
  349.    dime.cs.umass.edu:/gbb. The commercial GBB product is not.
  350.    Work on the UMass GBB project (and funding) ended over 2 years ago.
  351.    Many researchers using it have opted for the commercial
  352.    release.  The UMass research system remains available, but the
  353.    two should not be confused as the commercial system is
  354.    substantially improved and extended. The commercial system is available
  355.    from Blackboard Technology Group, PO Box 44, 401 Main Street,
  356.    Amherst, Massachusetts 01002, 413-256-4240.
  357.  
  358.    MVL (Multi-Valued Logic) is a theorem proving system written
  359.    in Common Lisp, and is available from t.stanford.edu:/mvl/mvl.tar.Z
  360.    A user's manual may be found in /mvl/manual.tex. Send mail
  361.    to ginsberg@t.stanford.edu.
  362.  
  363.    Postgres is an object-oriented database, and is available
  364.    from postgres.berkeley.edu:/pub/postgres*
  365.    It runs on DecStation 3100s, Sun3 (SunOs), Sun4 (Sparc),
  366.    and Sequent Symmetry.
  367.  
  368.    CL-Protos is a Common Lisp implementation of the case-based
  369.    reasoning system developed by E. Ray Bareiss and Bruce W.
  370.    Porter of the University of Texas/Austin AI Lab. It runs
  371.    on Sun3, TI Explorer, HP 9000, and Symbolics, and gobbles a
  372.    huge amount of memory. Common Lisp implementation by
  373.    Rita Duran, Dan Dvorak, Jim Kroger, Hilel Swerdlin, and Ben Tso.
  374.    For more information, bug reports, or comments, contact
  375.    either Dan Dvorak <dvorak@cs.utexas.edu> or Ray Bareiss
  376.    <bareiss@ils.nwu.edu> or Erik Eilerts <eilerts@cs.utexas.edu>
  377.    Available by anonymous ftp from cs.utexas.edu:/pub/porter
  378.  
  379.    QSIM is a qualitative reasoning system implemented in Common
  380.    Lisp. It is available by anonymous ftp from cs.utexas.edu:/pub/qsim
  381.  
  382.    ID3. A Lisp implementation of ID3 and other machine learning
  383.    algorithms is available by anonymous ftp from the machine learning
  384.    group at the University of Texas as cs.utexas.edu:pub/mooney
  385.  
  386.    RHETORICAL is a planning and knowledge tool available by
  387.    anonymous ftp from cs.rochester.edu:/pub/knowledge-tools
  388.    in the files rhet-19-40.tar.Z and cl-lib-3-11.tar.Z. The files
  389.    tempos-3-6.tar.Z and timelogic-5-0.tar.Z add James Allen's
  390.    interval logic to Rhet. It runs on Symbolics Genera and
  391.    Allegro Common Lisp. Written by Brad Miller <miller@cs.rochester.edu>.
  392.  
  393.    KNOWBEL is an implementation of Telos (a sorted/temporal logic
  394.    system) by Bryan M. Kramer, <kramer@ai.toronto.edu>. It is
  395.    available by anonymous ftp from ai.toronto.edu:/pub/kr/ as the
  396.    files knowbel.tar.Z and manual.txt.tar.Z 
  397.    Runs in Allegro CL on Sparcstations and Silicon Graphics 4d
  398.    and in MCL on Apple Macintoshes. 
  399.    
  400.    SNePS is a semantic net implementation, available free after
  401.    signing a license agreement. Contact shapiro@cs.buffalo.edu
  402.    for more information.
  403.  
  404.    PRODIGY is an integrated planning and learning system,
  405.    available free after signing a license agreement. Contact
  406.    prodigy@cs.cmu.edu for more information.
  407.  
  408.    SOAR is an integrated intelligent agent architecture currently
  409.    being developed at Carnegie Mellon University, the University of
  410.    Michigan, and the Information Sciences Institute of the University of
  411.    Souther California. Soar, and its companion systems, CParaOPS5 and
  412.    TAQL, have been placed in the public domain. The system may be
  413.    retrieved by anonymous ftp to ftp.cs.cmu.edu (or any other CMU CS
  414.    machine) in the directory /afs/cs.cmu.edu/project/soar/5.2/2/public/.
  415.    [Note: You must cd to this directory in one atomic operation, as
  416.    superior directories may be protected during an anonymous ftp.]  For
  417.    more information, send email to soar-request@cs.cmu.edu or write to
  418.    The Soar Group, School of Computer Science, Carnegie Mellon
  419.    University, Pittsburgh, PA 15213.  Finally, though the software is in
  420.    the public domain, the manual remains under copyright. To obtain one
  421.    (at no charge) send a request (including your physical mail address)
  422.    to soar-doc@cs.cmu.edu or to the physical address above.
  423.  
  424.    RegExp is an extension to Allegro Common Lisp which adds
  425.    regular expression string matching, using the foreign
  426.    function interface. Available by anonymous ftp from
  427.    ai.sri.com:/pub/pkarp/regexp/. Contact pkarp@ai.sri.com
  428.    for more information.
  429.  
  430.    SNLP is a domain independent systematic nonlinear planner,
  431.    available by anonymous ftp from cs.washington.edu:/pub/snlp.tar.Z
  432.    Contact weld@cs.washington.edu for more information. 
  433.  
  434.    TILEWORLD is a planning testbed/simulator developed at SRI
  435.    International by Martha Pollack, Michael Frank and Marc
  436.    Ringuette. TILEWORLD originally ran under Lucid CL, but was
  437.    later extended and ported to Allegro CL by Badr H. Al-Badr
  438.    and Steve Hanks. The new tileworld is available by anonymous
  439.    ftp from cs.washington.edu as the file new-tileworld.tar.Z
  440.    It includes an X interface.
  441.  
  442.    TRUCKWORLD is a simulated world intended to provide a 
  443.    testbed for AI planning programs, where the planning agent
  444.    is a truck that roams around the simulated world. It is
  445.    available by anonymous ftp from cs.washington.edu in the
  446.    file simulator.tar.Z. It includes an X interface. Contact
  447.    Steve Hanks <hanks@cs.washington.edu> for more information.
  448.  
  449.    COBWEB/3 is a concept formation system available free after
  450.    signing a license agreement. Contact cobweb@ptolemy.arc.nasa.gov
  451.    for more information.
  452.  
  453.    VEOS (Virtual Environment Operating Shell) is an extendible environment
  454.    for prototyping distributed applications for Unix. The programmer's
  455.    interface uses XLISP 2.1. Although intended for distributed
  456.    Virtual Reality applications at The Human Interface Technology Lab
  457.    in Seattle, it should be appropriate for other applications.  VEOS
  458.    uses heavyweight sequential processes, corresponding roughly to
  459.    unix processes. VEOS runs on DEC/5000, Sun4, and Silicon Graphics
  460.    VGX and Indigo. VEOS is available by anonymous ftp from
  461.    milton.u.washington.edu (128.95.136.1) in the directory ~ftp/public/veos
  462.    as veos.tar.Z. If you use the software, the authors ask that you send
  463.    them mail to veos-support@hitl.washington.edu.
  464.  
  465.    PAIL (Portable AI Lab) is a computing environment containing a
  466.    collection of state-of-the-art AI tools, examples, and documentation.
  467.    It is aimed at those involved in teaching AI courses at university
  468.    level or equivalent. The system has enough built-in functionality to
  469.    enable its users to get practical experience with a broad range of AI
  470.    problems without having to build all the supporting tools from
  471.    scratch. It is implemented in Common Lisp and uses CLOS and Allegro
  472.    Common Windows (i.e., in Allegro CL 4.1). It is available by anonymous
  473.    ftp from pobox.cscs.ch:/pub/ai/pail-2.1/. Written by Mike Rosner and
  474.    Dean Allemang {dean,mike}@idsia.ch.
  475.  
  476.    XSTAT is a statistics package which runs in XLISP. It has recently been
  477.    ported to Common Lisp, and is available as
  478.       umnstat.stat.umn.edu:/pub/xlispstat/CL/CLS1.0A1.tar.Z
  479.    The CL port does not yet include the lisp-stat dynamic graphics 
  480.    package, only the numerics.
  481.  
  482.    IDM is a Common Lisp implementation of both a classical and extended
  483.    version of the STRIPS planner. It is available by anonymous ftp from 
  484.    sauquoit.gsfc.nasa.gov (128.183.101.29). Questions, comments and bug
  485.    reports may be sent to idm-users@chelmsford.gsfc.nasa.gov.             
  486.  
  487. ----------------------------------------------------------------
  488. [2-1] Is there a GNU-Emacs interface to Lisp?
  489.  
  490. ILISP is a powerful GNU-Emacs interface to many dialects of
  491. Lisp, including Lucid, Allegro, {A}KCL, IBCL, and CMU. Written by
  492. Chris McConnell <ccm+@cs.cmu.edu>. It is available by anonymous
  493. ftp from katmandu.mt.cs.cmu.edu [128.2.250.68] in the directory
  494. pub/ilisp as the file ilisp.tar.Z. If you start using it, send
  495. Chris mail, as he maintains a mailing list of users.
  496.  
  497. Franz Inc.'s GNU-Emacs/Lisp interface includes an online Common
  498. Lisp manual. It is available by license from Franz Inc. Contact
  499. info@franz.com for more information. There is also a mailing list, 
  500. lisp-emacs-forum-request@ucbarpa.berkeley.edu.
  501.  
  502. The cl-shell package provides a major mode (cl-shell-mode) for running
  503. Common Lisp (CL) as an Emacs subprocess.  It provides a general
  504. mechanism for communication between CL and Emacs which does not rely
  505. on extra processes, and should therefore be easily portable to any
  506. version of CL.  Features include direct (i.e., not through a temp file)
  507. evaluation and in-package compilation of forms from lisp-mode buffers,
  508. type-ahead and a history mechanism for the cl-shell buffer, and pop-up
  509. help facilities for the CL functions documentation, macroexpand and
  510. describe.  Extensions for Lucid Common Lisp provide pop-up arglists
  511. and source file editing.  Other extensions are provided to allow
  512. editing source files of CLOS or Flavors methods.  Cl-shell is
  513. available on the Lucid tape (in the goodies directory) or via
  514. anonymous ftp from whitechapel.media.mit.edu (18.85.0.125).
  515.  
  516. Lucid includes some other Emacs-Lisp interfaces in its goodies directory.
  517.  
  518. Harlequin's LispWorks includes an Emacs-Lisp interface.
  519.  
  520. Venue's Medley has an optional EMACS Interface.
  521.  
  522. ----------------------------------------------------------------
  523. [2-2] How can I use the X Window System or other GUIs from Lisp?
  524.  
  525. There are several GUI's and Lisp interfaces to the X Window System. Mailing
  526. lists for these systems are listed in the answer to question [4-2].
  527. Various vendors also offer their own interface-building packages.
  528.  
  529.    CLX provides basic Common Lisp/X functionality. It is a de facto standard
  530.    low-level interface to X, providing equivalent functionality to XLib, but
  531.    in Lisp. It is also a good source for comparing the foreign function calls
  532.    in various Lisps. Does *not* depend on CLOS.  Available free as part of the
  533.    X release in the contrib directory.  Also available form
  534.    export.lcs.mit.edu:/contrib as the files CLX.Manual.tar.Z, CLX.R4.5.tar.Z
  535.    and CLX.R5.tar.Z Primary Interface Author: Robert W. Scheifler
  536.    <rws@zermatt.lcs.mit.edu> Send bug reports to bug-clx@expo.lcs.mit.edu.
  537.  
  538.    CLIM (Common Lisp Interface Manager) is a GUI originally developed by
  539.    Symbolics and International Lisp Associates, and now under joint
  540.    development by several Lisp vendors, including Symbolics, Apple, Franz, 
  541.    Harlequin and Lucid. It is intended to be a portable analogue of Symbolics
  542.    UIMS (Dynamic Windows, Presentations Types). It runs on Symbolics Lisp 
  543.    Machines; Allegro and Lucid on several Unix platforms; Symbolics CLOE on 
  544.    386/486 IBM PCs running Windows; and MCL on Apple Macintoshes.  It is *not*
  545.    free, and with the exception of Macintoshes, if it is available it
  546.    can be purchased from the vendor of the Lisp system you are using.
  547.    For the Macintosh version write to the ILA:
  548.         International Lisp Associates, 114 Mt. Auburn St.,
  549.         Cambridge, MA 02138, 617-576-1151
  550.         Contact: Dennis Doughty - Doughty@ILA.com
  551.  
  552.         International Lisp Associates, 898 Windmill Park Road,
  553.         Mountain View, CA 94043, 1-800-477-CLIM
  554.         Contact: Bill York - York@ILA.com
  555.    The CLIM 2.0 SPECIFICATION is available by anonymous ftp from
  556.    ftp.uunet.net:vendor/franz/clim.ps.Z.
  557.  
  558.    CLUE (Common Lisp User-Interface Environment) is from TI, and extends CLX
  559.    to provide a simple, object-oriented toolkit (like Xt) library that uses
  560.    CLOS. Provides basic window classes, some stream I/O facilities, and a few
  561.    other utilities. Still pretty low level (it's a toolkit, not widget
  562.    library).  Available free by anonymous ftp from csc.ti.com:pub/clue.tar.Z
  563.    Written by Kerry Kimbrough. Send bug reports to clue-bugs@dsg.csc.ti.com.
  564.  
  565.    CLIO (Common Lisp Interactive Objects) is a GUI from the people who created
  566.    CLUE. It provides a set of CLOS classes that represent the standard
  567.    components of an object-oriented user interface -- such as text, menus,
  568.    buttons, scroller, and dialogs.  It is included as part of the CLUE
  569.    distribution, along with some packages that use it, both sample and real.
  570.  
  571.    Allegro Common Windows provides a front end to CLX. Uses CLOS.
  572.    It is *not* free. Contact info@franz.com for more information.
  573.  
  574.    The LispWorks Toolkit is an extensible CLOS-based widget set that uses
  575.    CLX and CLUE. The LispWorks programming environment has been written
  576.    using the toolkit and includes: an Emacs-like editor, listener,
  577.    debugger, profiler, and operating system shell; browsers/graphers for
  578.    classes, generic functions, processes, windows, files, compilation
  579.    errors, source code systems, and setting LispWorks parameters; and an
  580.    interactive interface builder and complete online hypertext
  581.    documentation. Contact: lispworks-request@harlqn.co.uk
  582.  
  583.    CLM (Common Lisp Motif) and GINA (Generic Interactive Application) and IB
  584.    (Interface Builder). CLM runs Motif widgets in a separate C process, with
  585.    minimal work on the Lisp side and communicates between C and Lisp using TCP
  586.    sockets. Runs in Allegro CL, Sun CL, and Symbolics Genera. GINA uses CLOS.
  587.    Available free in the X contrib directory or by anonymous ftp from either
  588.    export.lcs.mit.edu:/contrib or ftp.gmd.de:/gmd/gina [129.26.8.90] as the
  589.    files CLM+GINA.README, CLM2.1.tar.Z and GINA2.1.tar.Z.  CLM was written by
  590.    Andreas Baecker <baecker@gmdzi.gmd.de>, GINA by Mike Spenke
  591.    <spenke@gmdzi.gmd.de>, and IB by Thomas Berlage <berlage@gmdzi.gmd.de>.
  592.    Contact Mike Spenke for more info. 
  593.  
  594.    EW (Express Windows) is intended to mimic Symbolics' Dynamic Windows user
  595.    and programmer interfaces. It is available free in the ew/ subdirectory of
  596.    the Lisp Utilities repository.  It is no longer under active development.
  597.    Runs on Sun/Lucid, Franz Allegro, and Symbolics. Should port easily to
  598.    other Lisps with CLX. 
  599.    Written by Andrew L. Ressler <aressler@oiscola.columbia.ncr.com>.
  600.  
  601.    Garnet is a large and flexible GUI. Lots of high-level features.  Does
  602.    *not* depend on CLOS, but does depend on CLX. Garnet (version 2.0 and
  603.    after) is now in the public domain, and has no licensing restrictions,
  604.    so it is available to all foreign sites and for commercial uses.
  605.    Detailed instructions for obtaining it by anonymous ftp are available
  606.    by anonymous ftp from a.gp.cs.cmu.edu [128.2.242.7] as the file
  607.    /usr/garnet/garnet/README.  Garnet includes the Lapidiary interactive
  608.    design tool, Gilt Interface Builder, automatic display management, two
  609.    widget sets (Motif look-and-feel and Garnet look-and-feel), support for
  610.    gesture recognition, and automatic constraint maintenance, application
  611.    data layout and PostScript generation. Runs in virtually any Common
  612.    Lisp environment, including Allegro, Lucid, CMU, and Harlequin Common
  613.    Lisps on Sun, DEC, HP, Apollo, IBM 6000, and many other machines.
  614.    Garnet helps implement highly-interactive, graphical, direct
  615.    manipulation programs for X/11 in Common Lisp.  Typical applications
  616.    include: drawing programs similar to Macintosh MacDraw, user interfaces
  617.    for expert systems and other AI applications, box and arrow diagram
  618.    editors, graphical programming languages, game user interfaces,
  619.    simulation and process monitoring programs, user interface construction
  620.    tools, CAD/CAM programs, etc. Contact Brad Myers (bam@a.gp.cs.cmu.edu)
  621.    for more information. Bug reports and administrative questions:
  622.    garnet@cs.cmu.edu.
  623.  
  624.    LispView is a GUI written at Sun that does not use CLX.  Instead it
  625.    converts Xlib.h directly into Lucid foreign function calls. It is intended
  626.    to be fast and tight. Uses CLOS.  Available for anonymous ftp from
  627.       export.lcs.mit.edu:contrib/lispview1.1 and 
  628.       xview.ucdavis.edu:pub/XView/LispView1.1 
  629.    Includes a general-purpose 2D grapher library.
  630.    Written by Hans Muller (hmuller@sun.com). Runs in Sun CL and Lucid CL.
  631.    Direct questions about the source provision to lispview@Eng.Sun.Com.
  632.    
  633.    WINTERP (Widget INTERPreter) was developed at HP and uses the Xtoolkit and
  634.    Motif widget set. It is based on David Betz's XLISP interpreter, which is a
  635.    small subset of Common Lisp that runs on IBM PCs. Runs on DecStation 3100,
  636.    HP9000s, Sun3, Sparcs.  It is a free-standing Lisp-based tool for setting
  637.    up window applications. Available free in X contrib directory, or by
  638.    anonymous ftp from export.lcs.mit.edu:contrib/winterp-???.tar.Z where ???
  639.    is the version number.  If you do not have Internet access you may request
  640.    the source code to be mailed to you by sending a message to
  641.    winterp-source%hplnpm@hplabs.hp.com or hplabs!hplnpm!winterp-source.
  642.    Contact Niels Mayer mayer@hplabs.hp.com for more information.  
  643.  
  644.    YYonX is a port of the YY system to X windows. Runs in Lucid CL, Allegro
  645.    CL, and Symbolics Genera. Supports kanjii.  Developed at Aoyama Gakuin
  646.    University. Available free by anonymous ftp from ftp.csrl.aoyama.ac.jp:YY/
  647.    Written by Masayuki Ida <ida@cc.aoyama.ac.jp>
  648.  
  649.    Picasso is a CLOS based GUI, and is available from
  650.    postgres.berkeley.edu:/pub/Picasso-2.0 It runs on DecStation 3100s, Sun3
  651.    (SunOs), Sun4 (Sparc), and Sequent Symmetry in Allegro CL. The file
  652.    pub/xcl.tar.Z contains X-Common Lisp interface routines. Send mail to
  653.    picasso@postgres.berkeley.edu for more information.
  654.  
  655.    XIT (X User Interface Toolkit) is an object-oriented user interface
  656.    toolkit for the X Window System based on Common Lisp, CLOS, CLX, and
  657.    CLUE. It has been developed by the Research Group DRUID at the
  658.    Department of Computer Science of the University of Stuttgart as a
  659.    framework for Common Lisp/CLOS applications with graphical user
  660.    interfaces for the X Window System.  The work is based on the USIT
  661.    system developed by the Research Group INFORM at the University of
  662.    Stuttgart. Although the system kernel is quite stable, XIT is still
  663.    under active development. XIT can be obtained free by anonymous ftp
  664.    from ifi.informatik.uni-stuttgart.de (129.69.211.1) in the directory
  665.    /pub/xit/.
  666.  
  667.  
  668. ----------------------------------------------------------------
  669. [2-3] When is it right to use EVAL?
  670.  
  671. Hardly ever.  Any time you think you need to use EVAL, think hard about it.
  672. EVAL is useful when implementing a facility that provides an external
  673. interface to the Lisp interpreter.  For instance, many Lisp-based editors
  674. provide a command that prompts for a form and displays its value.
  675. Inexperienced macro writers often assume that they must explicitly EVAL the
  676. subforms that are supposed to be evaluated, but this is not so; the correct
  677. way to write such a macro is to have it expand into another form that has
  678. these subforms in places that will be evaluated by the normal evaluation
  679. rules.  Explicit use of EVAL in a macro is likely to result in one of two
  680. problems: the dreaded "double evaluation" problem, which may not show up
  681. during testing if the values of the expressions are self-evaluating
  682. constants (such as numbers); or evaluation at compile time rather than
  683. runtime.  For instance, if Lisp didn't have IF and one desired to write it,
  684. the following would be wrong:
  685.  
  686.    (defmacro if (test then-form &optional else-form)
  687.      ;; this evaluates all the subforms at compile time, and at runtime
  688.      ;; evaluates the results again.
  689.      `(cond (,(eval test) ,(eval then-form))
  690.             (t ,(eval else-form))))
  691.  
  692.    (defmacro if (test then-form &optional else-form)
  693.      ;; this double-evaluates at run time
  694.      `(cond ((eval ,test) (eval ,then-form))
  695.             (t (eval ,else-form)))
  696.  
  697. This is correct:
  698.  
  699.    (defmacro if (test then-form &optional else-form)
  700.      `(cond (,test ,then-form)
  701.             (t ,else-form)))
  702.  
  703. On the other hand, EVAL can sometimes be necessary when the only portable
  704. interface to an operation is a macro. 
  705.  
  706. ----------------------------------------------------------------
  707. [2-4] What is the equivalent of EXPLODE and IMPLODE in Common Lisp?
  708.  
  709. Hopefully, the only reason you need to do this is as part of trying to port
  710. some old MacLisp code to Common Lisp.  These functions predated the
  711. inclusion of strings as a first-class data type in Lisp; symbols were used
  712. as strings, and they ere EXPLODEd to allow the individual characters to be
  713. manipulated in a list.
  714.  
  715. Probably the best approximations of these are:
  716.  
  717.    (defun explode (object)
  718.      (loop for char across (prin1-to-string object)
  719.            collect (intern (string char))))
  720.  
  721.    (defun implode (list)
  722.      (read-from-string (coerce (mapcar #'character list) 'string)))
  723.  
  724. An alternate definition of EXPLODE which uses MAP instead of LOOP is:
  725.  
  726.    (defun explode (object)
  727.      (map 'list #'(lambda (char) 
  728.             (intern (string char)))
  729.       (prin1-to-string object)))
  730.  
  731. The creation of N conses of garbage to process a string of N
  732. characters is a hideously inefficient way of doing the job.  Rewrite
  733. EXPLODE code with PRIN1-TO-STRING, or better STRING if the arguments
  734. are symbols without funny characters.  For IMPLODE, try to make its
  735. caller use strings and try to make the result usable as a string to
  736. avoid having to call INTERN or READ-FROM-STRING.
  737.  
  738. ----------------------------------------------------------------
  739. [2-5] Is Lisp inherently slower than more conventional languages such as C?
  740.  
  741. This is a tough question to answer, as I'm sure you expected.  In many
  742. cases, it appears to be.  Lisp does not require the programmer to specify
  743. the data type of variables, so generic arithmetic operators may have to
  744. perform type checking at runtime in order to determine how to proceed.
  745. However, Lisp code can also be dense (i.e.  there is more expressed in a
  746. single line) than many other languages: the Lisp expression (+ A B) is more
  747. powerful than the C expression A+B (the Lisp version supports bignums,
  748. rationals, and complex numbers, while the C version only supports
  749. limited-size integers and floating point); therefore, one may claim that it
  750. is reasonable that the Lisp version take longer than the C version (but
  751. don't expect everyone to accept this rationalization).  Solutions to this
  752. include hardware support (e.g. processors that support type tags in data,
  753. such as SPARC and Symbolics Lisp Machines), declarations, and specialized
  754. variants of functions (e.g. in MacLisp, + accepts and returns only fixnums,
  755. +$ accepts and returns only flonums, and PLUS is generic).
  756.  
  757. At one time, the MIT PDP-10 MacLisp compiler was compared to DEC's PDP-10
  758. Fortran compiler.  When appropriate declarations were supplied in the Lisp
  759. code, the performance of compiled Lisp arithmetic rivaled that of the
  760. Fortran code.  It would hardly be fair to compare Lisp without declarations
  761. to Fortran, since the Fortran compiler would have more information upon
  762. which it could base its optimizations.
  763.  
  764. Since Lisp is a good language for rapid prototyping, it is easy for a
  765. mediocre programmer (or even a good programmer, who isn't being careful) to
  766. generate a large amount of inefficient Lisp code. A good example is the use
  767. of APPEND to link successive lists together, instead of keeping a pointer
  768. to the tail of the list. Often a programmer can obtain significant
  769. speed increases by using a time/space profiler to identify the
  770. functions which waste time (often small functions which are called
  771. frequently) and rewriting those functions.
  772.      
  773. ----------------------------------------------------------------
  774. [2-6] Why does my program's behavior change each time I use it?
  775.  
  776. Most likely your program is altering itself, and the most common way this
  777. may happen is by performing destructive operations on embedded constant
  778. data structures.  For instance, consider the following:
  779.  
  780.    (defun one-to-ten-except (n)
  781.      (delete n '(1 2 3 4 5 6 7 8 9 10)))
  782.    (one-to-ten-except 3) => (1 2 4 5 6 7 8 9 10)
  783.    (one-to-ten-except 5) => (1 2 4 6 7 8 9 10) ; 3 is missing
  784.  
  785. The basic problem is that QUOTE returns its argument, *not* a copy of
  786. it. The list is actually a part of the lambda expression that is in
  787. ONE-TO-TEN-EXCEPT's function cell, and any modifications to it (e.g., by
  788. DELETE) are modifications to the actual object in the function definition.
  789. The next time that the function is called, this modified list is used.
  790.  
  791. In some implementations calling ONE-TO-TEN-EXCEPT may even result in
  792. the signalling of an error or the complete aborting of the Lisp process.  Some
  793. Lisp implementations put self-evaluating and quoted constants onto memory
  794. pages that are marked read-only, in order to catch bugs such as this.
  795. Details of this behavior may vary even within an implementation,
  796. depending on whether the code is interpreted or compiled (perhaps due to
  797. inlined DEFCONSTANT objects).
  798.  
  799. All of these behaviors are allowed by the draft ANSI Common Lisp
  800. specification, which specifically states that the consequences of modifying
  801. a constant are undefined (X3J13 vote CONSTANT-MODIFICATION:DISALLOW).
  802.  
  803. To avoid these problems, use LIST to introduce a list, not QUOTE. QUOTE
  804. should be used only when the list is intended to be a constant which
  805. will not be modified.  If QUOTE is used to introduce a list which will
  806. later be modified, use COPY-LIST to provide a fresh copy.
  807.  
  808. For example, the following should all work correctly:
  809.  
  810.    o  (remove 4 (list 1 2 3 4 1 3 4 5))
  811.    o  (remove 4 '(1 2 3 4 1 3 4 5))   ;; Remove is non-destructive.
  812.    o  (delete 4 (list 1 2 3 4 1 3 4 5))
  813.    o  (let ((x (list 1 2 4 1 3 4 5)))
  814.     (delete 4 x))
  815.    o  (defvar *foo* '(1 2 3 4 1 3 4 5))
  816.       (delete 4 (copy-list *foo*))
  817.       (remove 4 *foo*)
  818.       (let ((x (copy-list *foo*)))
  819.      (delete 4 x))
  820.  
  821. The following, however, may not work as expected:
  822.  
  823.    o  (delete 4 '(1 2 3 4 1 3 4 5))
  824.      
  825. ----------------------------------------------------------------
  826. [2-7] Why does Common Lisp have "#'"?
  827.  
  828. #' is a macro-character which expands #'FOO to (FUNCTION FOO).  Symbols in
  829. Lisp have two bindings, one for values and one for functions, allowing them
  830. to represent both variables and functions, depending on context. #'FOO
  831. accesses FOO's lexical function binding in a context where the value
  832. interpretation would normally occur.  #' is also used to create lexical
  833. closures for lambda expressions. A lexical closure is a function which when
  834. invoked executes the body of the lambda-expression in the lexical
  835. environment within which the closure was created.  See pp. 115-117 of CLtL2
  836. for more details.
  837.  
  838. ----------------------------------------------------------------
  839. [2-8] How do I call non-Lisp functions from Lisp?
  840.  
  841. Most Lisp implementations for systems where Lisp is not the most common
  842. language provide a "foreign function" interface.  As of now there has been
  843. no significant standardization effort in this area.  They tend to be
  844. similar, but there are enough differences that it would be inappropriate to
  845. try to describe them all here.  In general, one uses an
  846. implementation-dependent macro that defines a Lisp function, but instead of
  847. supplying a body for the function supplies the name of a function written
  848. in another language; the argument list portion of the definition is
  849. generally augmented with the data types the foreign function expects and
  850. the data type of the foreign function's return value, and the Lisp
  851. interface function arranges to do any necessary conversions.  There is also
  852. generally a function to "load" an object file or library compiled in a
  853. foreign language, which dynamically links the functions in the file being
  854. loaded into the address space of the Lisp process, and connects the
  855. interface functions to the corresponding foreign functions.
  856.  
  857. If you need to do this, see the manual for your language implementation for
  858. full details.  In particular, be on the lookout for restrictions on the
  859. data types that may be passed.  You may also need to know details about the
  860. linkage conventions that are used on your system; for instance, many C
  861. implementations prepend an underscore onto the names of C functions when
  862. generating the assembler output (this allows them to use names without
  863. initial underscores internally as labels without worrying about conflicts),
  864. and the foreign function interface may require you to specify this form
  865. explicitly.
  866.  
  867. Franz Allegro Common Lisp's "Foreign Function Call Facility" is
  868. described in chapter 10 of the documentation. Calling Lisp Functions
  869. from C is treated in section 10.8.2. The foreign function interface in
  870. Macintosh Common Lisp is similar. The foreign function interface for
  871. KCL is described in chapter 10 of the KCL Report. The foreign function
  872. interfaces for Lucid on the Vax and Lucid on the Sun4 are
  873. incompatible. Lucid's interface is described in chapter 5 of the
  874. Advanced User's Guide.
  875.  
  876. ----------------------------------------------------------------
  877. [2-9] Can I call Lisp functions from other languages?
  878.  
  879. In implementations that provide a foreign function interface as described
  880. above, there is also usually a "callback" mechanism.  The programmer may
  881. associate a foreign language function name with a Lisp function.  When a
  882. foreign object file or library is loaded into the Lisp address space, it is
  883. linked with these callback functions.  As with foreign functions, the
  884. programmer must supply the argument and result data types so that Lisp may
  885. perform conversions at the interface.
  886.      
  887. ----------------------------------------------------------------
  888.  
  889. [2-10] I want to call a function in a package that might not exist at
  890.        compile time. How do I do this?
  891.  
  892. Use (funcall (find-symbol "SYMBOL-NAME" :pkg-name) ...).
  893.  
  894. ----------------------------------------------------------------
  895. [2-11] What is CDR-coding?
  896.  
  897. CDR-coding is a space-saving way to store lists in memory.  It is normally
  898. only used in Lisp implementations that run on processors that are
  899. specialized for Lisp, as it is difficult to implement efficiently
  900. in software.  In normal list structure, each element of the
  901. list is represented as a CONS cell, which is basically two pointers (the
  902. CAR and CDR); the CAR points to the element of the list, while the CDR
  903. points to the next CONS cell in the list or NIL.  CDR-coding takes
  904. advantage of the fact that most CDR cells point to another CONS, and
  905. further that the entire list is often allocated at once (e.g. by a call to
  906. LIST).  Instead of using two pointers to implement each CONS cell, the CAR
  907. cell contains a pointer and a two-bit "CDR code".  The CDR code may contain
  908. one of three values: CDR-NORMAL, CDR-NEXT, and CDR-NIL.  If the code is
  909. CDR-NORMAL, this cell is the first half of an ordinary CONS cell pair, and
  910. the next cell in memory contains the CDR pointer as described above.  If
  911. the CDR code is CDR-NEXT, the next cell in memory contains the next CAR
  912. cell; in other words, the CDR pointer is implicitly thisaddress+1, where
  913. thisaddress is the memory address of the CAR cell.  If the CDR code is
  914. CDR-NIL, then this cell is the last element of the list; the CDR pointer is
  915. implicitly a reference to the object NIL.  When a list is constructed
  916. incrementally using CONS, a chain of ordinary pairs is created; however,
  917. when a list is constructed in one step using LIST or MAKE-LIST, a block of
  918. memory can be allocated for all the CAR cells, and their CDR codes all set
  919. to CDR-NEXT (except the last, which is CDR-NIL), and the list will only
  920. take half as much storage (because all the CDR pointers are implicit).
  921.  
  922. If this were all there were to it, it would not be difficult to implement
  923. in software on ordinary processors; it would add a small amount of overhead
  924. to the CDR function, but the reduction in paging might make up for it.  The
  925. problem arises when a program uses RPLACD on a CONS cell that has a CDR
  926. code of CDR-NEXT or CDR-NIL.  Normally RPLACD simply stores into the CDR
  927. cell of a CONS, but in this case there is no CDR cell -- its contents are
  928. implicitly specified by the CDR code, and the word that would normally
  929. contain the CDR pointer contains the next CONS cell (in the CDR-NEXT case)
  930. to which other data structures may have pointers, or the first word of some
  931. other object (in the CDR-NIL case).  When CDR-coding is used, the
  932. implementation must also provide automatic "forwarding pointers"; an
  933. ordinary CONS cell is allocated, the CAR of the original cell is copied
  934. into its CAR, the value being RPLACD'ed is stored into its CDR, and the old
  935. CAR cell is replaced with a forwarding pointer to the new CONS cell.
  936. Whenever CAR or CDR is performed on a CONS, it must check whether the
  937. location contains a forwarding pointer.  This overhead on both CAR and CDR,
  938. coupled with the overhead on CDR to check for CDR codes, is generally
  939. enough that using CDR codes on conventional hardware is infeasible.
  940.  
  941. There is some evidence that CDR-coding doesn't really save very much
  942. memory, because most lists aren't constructed at once, or RPLACD is done on
  943. them enough that they don't stay contiguous.  At best this technique can
  944. save 50% of the space occupied by CONS cells. However, the savings probably
  945. depends to some extent upon the amount of support the implementation
  946. provides for creating CDR-coded lists.  For instance, many system functions
  947. on Symbolics Lisp Machines that operate on lists have a :LOCALIZE option;
  948. when :LOCALIZE T is specified, the list is first modified and then copied
  949. to a new, CDR-coded block, with all the old cells replaced with forwarding
  950. pointers.  The next time the garbage collector runs, all the forwarding
  951. pointers will be spliced out.  Thus, at a cost of a temporary increase in
  952. memory usage, overall memory usage is generally reduced because more lists
  953. may be CDR-coded. There may also be some benefit in improved paging
  954. performance due to increased locality as well (putting a list into
  955. CDR-coded form makes all the "cells" contiguous). Nevertheless, modern
  956. Lisps tend to use lists much less frequently, with a much heavier
  957. reliance upon code, strings, and vectors (structures).
  958.  
  959. ----------------------------------------------------------------
  960. [2-12] What is garbage collection?
  961.  
  962. Garbage Collection (GC) refers to the automatic storage allocation
  963. mechanisms present in many Lisps. There are several kinds of storage
  964. allocation algorithms, but most fall within two main classes:
  965.  
  966.    1. Stop and Copy. Systems which copy active objects from "old"
  967.       storage to "new" storage and then recycle the old storage.
  968.  
  969.    2. Mark and Sweep. Systems which link together storage
  970.       used by discarded objects. 
  971.  
  972. Generational scavenging garbage collection is a variation in which
  973. memory is allocated in layers, with tenured (long-lived) objects in
  974. the older layers. Rather than doing a full GC of all of memory every
  975. time more room is needed, only the last few layers are GCed during an
  976. ephemeral GC, taking much less time. Short-lived objects are quickly
  977. recycled, and full GCs are then much less frequent. It is most often
  978. used to improve the performance of stop and copy garbage collectors.
  979. It is possible to implement ephemeral GC in mark and sweep systems,
  980. just much more difficult.
  981.  
  982. Stop and copy garbage collection provides simpler storage allocation,
  983. avoids fragmentation of memory (intermixing of free storage with used
  984. storage). Copying, however, consumes more of the address space, since up to
  985. half the space must be kept available for copying all the active objects.
  986. This makes stop and copy GC impractical for systems with a small address
  987. space or without virtual memory.  Also, copying an object requires that you
  988. track down all the pointers to an object and update them to reflect the new
  989. address, while in a non-copying system you need only keep one pointer to an
  990. object, since its location will not change. It is also more difficult to
  991. explicitly return storage to free space in a copying system.
  992.  
  993. Garbage collection is not part of the Common Lisp standard. Most Lisps
  994. provide a function ROOM which provides human-readable information about the
  995. state of storage usage. In many Lisps, (gc) invokes an ephemeral garbage
  996. collection, and (gc t) a full garbage collection.
  997.  
  998. ----------------------------------------------------------------
  999. [2-13] How do I save an executable image of my loaded Lisp system?
  1000.        How do I run a Unix command in my Lisp?
  1001.        How do I get the current directory name from within a Lisp program?
  1002.  
  1003. There is no standard for dumping a Lisp image. Here are the
  1004. commands from some lisp implementations:
  1005.    Lucid:              DISKSAVE
  1006.    Symbolics:          Save World  [CP command]
  1007.    CMU CL:             SAVE-LISP
  1008.    Franz Allegro:      EXCL:DUMPLISP (documented) 
  1009.             SAVE-IMAGE (undocumented)
  1010.    Medley:         IL:SYSOUT or IL:MAKESYS
  1011.    MCL:                SAVE-APPLICATION <pathname>
  1012.               &key :toplevel-function  :creator :excise-compiler
  1013.               :size :resources :init-file :clear-clos-caches
  1014.    KCL:                 (si:save-system "saved_kcl")
  1015.  
  1016. There is no standard for running a Unix shell command from Lisp,
  1017. especially since not all Lisps run on top of Unix. Here are the
  1018. commands from some Lisp implementations:
  1019.    Allegro:        EXCL:RUN-SHELL-COMMAND
  1020.    Lucid:        RUN-PROGRAM (name 
  1021.                      &key input output
  1022.                           error-output (wait t) arguments
  1023.                       (if-input-does-not-exist :error)
  1024.                       (if-output-exists :error)
  1025.                       (if-error-output-exists :error))
  1026.    KCL:                 SYSTEM 
  1027.             For example, (system "ls -l").
  1028.  
  1029. There's no standard function for finding the current directory from
  1030. within a Lisp program, since not all Lisp environments have the
  1031. concept of a current directory. Here are the commands from some Lisp
  1032. implementations:
  1033.    Lucid:        working-directory (which is also SETFable)
  1034.             pwd and cd also work
  1035.    Allegro:        current-directory (use excl:chdir to change it)
  1036.    CMU CL:              default-directory
  1037.  
  1038. Allegro also uses the variable *default-pathname-defaults* to resolve
  1039. relative pathnames, maintaining it as the current working directory.
  1040. So evaluating (truename "./") in Allegro (and on certain other
  1041. systems) will return a pathname for the current directory. Likewise,
  1042. in some VMS systems evaluating (truename "[]") will return a pathname
  1043. for the current directory.
  1044.  
  1045. ----------------------------------------------------------------
  1046. [2-14] I'm porting some code from a Symbolics Lisp machine to some
  1047.      other platform, and there are strange characters in the code.
  1048.      What do they mean?
  1049.  
  1050. The Symbolics Zetalisp character set includes the following
  1051. characters not present in other Lisps:
  1052.    ^]      >=      greater than or equal to
  1053.    ^\      <=      less than or equal to
  1054.    ^Z      !=      not equal to
  1055.    ^^      ==      equivalent to 
  1056.    ^E      not
  1057.    ^G      pi
  1058.    ^L      +/-       plus/minus
  1059.    ^H      lambda
  1060.    ^F      epsilon
  1061.    ^W      <-->    left/right arrow
  1062.    ^X      <--     left arrow
  1063.    ^Y      -->     right arrow
  1064.  
  1065. Other special characters to look out for are the font-change characters,
  1066. which are represented as a ^F followed by a digit or asterisk. A digit
  1067. means to push font #N onto the stack; an asterisk means to pop the most
  1068. recent font from the stack. You can clean up the code by replacing "\^F."
  1069. with "".
  1070.      
  1071. ----------------------------------------------------------------
  1072. [2-15] History: Where did Lisp come from?
  1073.  
  1074. John McCarthy developed the basics behind Lisp during the 1956 Dartmouth
  1075. Summer Research Project on Artificial Intelligence.  He intended it as an
  1076. algebraic LISt Processing (hence the name) language for artificial
  1077. intelligence work. Early implementations included the IBM 704, the IBM
  1078. 7090, the DEC PDP-1, the DEC PDP-6 and the DEC PDP-10. The PDP-6 and
  1079. PDP-10 had 18-bit addresses and 36-bit words, allowing a CONS cell to
  1080. be stored in one word, with single instructions to extract the CAR and
  1081. CDR parts. The early PDP machines had a small address space, which
  1082. limited the size of Lisp programs. 
  1083.  
  1084. Milestones in the development of Lisp:
  1085.  
  1086.    1956            Dartmouth Summer Research Project on AI.
  1087.  
  1088.    1960-65         Lisp1.5 is the primary dialect of Lisp.
  1089.  
  1090.    1964-           Development of BBNLisp at BBN.
  1091.  
  1092.    late 60s        Lisp1.5 diverges into two main dialects:
  1093.                    Interlisp (originally BBNLisp) and MacLisp.
  1094.  
  1095.    early 70s       Development of special-purpose computers known as Lisp
  1096.                    Machines, designed specificly to run Lisp programs. 
  1097.                    Xerox D-series Lisp Machines run Interlisp-D. 
  1098.                    Early MIT Lisp Machines run Lisp Machine Lisp 
  1099.                    (an extension of MacLisp).
  1100.  
  1101.    1969            Anthony Hearn and Martin Griss define Standard Lisp to
  1102.                    port REDUCE, a symbolic algebra system, to a variety
  1103.                    of architectures.  
  1104.  
  1105.    late 70s        Macsyma group at MIT developed NIL (New Implementation
  1106.                    of Lisp), a Lisp for the VAX.
  1107.  
  1108.                    Stanford and Lawrence Livermore National Laboratory
  1109.                    develop S-1 Lisp for the Mark IIA supercomputer.
  1110.  
  1111.                    Franz Lisp (dialect of MacLisp) runs on stock-hardware
  1112.                    Unix machines.
  1113.  
  1114.                    Gerald J. Sussman and Guy L. Steele developed Scheme,
  1115.                    a simple dialect of Lisp with lexical scoping and
  1116.                    lexical closures, continuations as first-class objects,
  1117.                    and a simplified syntax (i.e., only one binding per symbol).
  1118.  
  1119.                    Advent of object-oriented programming concepts in Lisp.
  1120.                    Flavors was developed at MIT for the Lisp machine,
  1121.                    and LOOPS (Lisp Object Oriented Programming System) was
  1122.                    developed at Xerox. 
  1123.  
  1124.    early 80s       Development of SPICE-Lisp at CMU, a dialect of MacLisp
  1125.                    designed to run on the Scientific Personal Integrated
  1126.                    Computing Environment (SPICE) workstation.
  1127.  
  1128.    1980            First biannual ACM Lisp and Functional Programming Conf.
  1129.  
  1130.    1981            PSL (Portable Standard Lisp) runs on a variety of platforms.
  1131.  
  1132.    1981+           Lisp Machines from Xerox, LMI (Lisp Machines Inc) 
  1133.                    and Symbolics available commercially.
  1134.  
  1135.    April 1981      Grass roots definition of Common Lisp as a description
  1136.                    of the common aspects of the family of languages (Lisp
  1137.                    Machine Lisp, MacLisp, NIL, S-1 Lisp, Spice Lisp, Scheme). 
  1138.                    
  1139.  
  1140.    1984            Publication of CLtL1. Common Lisp becomes a de facto 
  1141.                    standard.
  1142.  
  1143.    1986            X3J13 forms to produce a draft for an ANSI Common Lisp
  1144.                    standard. 
  1145.  
  1146.    1987            Lisp Pointers commences publication.
  1147.  
  1148.    1990            Publication of CLtL2. Includes X3J13's additions of
  1149.            CLOS, conditions, pretty printing and iteration facilities.
  1150.  
  1151. [Note: This summary is based primarily upon the History section of the
  1152. draft ANSI specification. More detail and references can be obtained from
  1153. that document when it becomes generally available.]
  1154. ----------------------------------------------------------------
  1155. [2-16]  How do I find the argument list of a function?
  1156.  
  1157. There is no standard way to find the argument list of a function,
  1158. since implementations are not required to save this information.
  1159. However, many implementations do remember argument information, and
  1160. usually have a function that returns the lambda list. Here are the
  1161. commands from some Lisp implementations:
  1162.  
  1163.    Lucid:                arglist
  1164.    Allegro:                    excl::arglist
  1165.    Symbolics:                arglist
  1166.  
  1167. CMU Common Lisp, new compiler:
  1168.    #+(and :CMU :new-compiler)
  1169.    (defun arglist (name)
  1170.      (let* ((function (symbol-function name))
  1171.         (stype (system:%primitive get-vector-subtype function)))
  1172.        (when (eql stype system:%function-entry-subtype)
  1173.      (cadr (system:%primitive header-ref function
  1174.                   system:%function-entry-type-slot)))))
  1175.  
  1176. If you're interested in the number of required arguments you could use
  1177.  
  1178.    (defun required-arguments (name)
  1179.      (or (position-if #'(lambda (x) (member x lambda-list-keywords))
  1180.               (arglist name))
  1181.      (length (arglist name))))
  1182.  
  1183. ----------------------------------------------------------------
  1184. [2-17]  How can I have two Lisp processes communicate via unix sockets?
  1185.  
  1186. CLX uses Unix sockets to communicate with the X window server. Look at
  1187. the following files from the CLX distribution for a good example of
  1188. using Unix sockets from Lisp:
  1189.     defsystem.lisp        Lucid, AKCL, IBCL, CMU.
  1190.     socket.c, sockcl.lisp    AKCL, IBCL
  1191.     excldep.lisp        Franz Allegro CL
  1192. You will need the "socket.o" files which come with Lucid and Allegro.
  1193. To obtain CLX, see the entry for CLX in the answer to question [2-2].
  1194.  
  1195. See the file lisp-sockets.text in the Lisp Utilities repository
  1196. described in the answer to question [2-0].
  1197.  
  1198. ----------------------------------------------------------------
  1199. [2-18]  When producing formatted output in Lisp, where should you put the
  1200.         newlines (e.g., before or after the line, FRESH-LINE vs TERPRI,
  1201.         ~& vs ~% in FORMAT)?
  1202.  
  1203.  
  1204. Where possible, it is desirable to write functions that produce output
  1205. as building blocks. In contrast with other languages, which either
  1206. conservatively force a newline at various times or require the program
  1207. to keep track of whether it needs to force a newline, the Lisp I/O
  1208. system keeps track of whether the most recently printed character was
  1209. a newline or not. The function FRESH-LINE outputs a newline only if
  1210. the stream is not already at the beginning of a line.  TERPRI forces a
  1211. newline irrespective of the current state of the stream. These
  1212. correspond to the ~& and ~% FORMAT directives, respectively. (If the
  1213. Lisp I/O system can't determine whether it's physically at the
  1214. beginning of a line, it assumes that a newline is needed, just in case.)
  1215.  
  1216. Thus, if you want formatted output to be on a line of its own, start
  1217. it with ~& and end it with ~%. (Some people will use a ~& also at the
  1218. end, but this isn't necessary, since we know a priori that we're not
  1219. at the beginning of a line. The only exception is when ~& follows a
  1220. ~A, to prevent a double newline when the argument to the ~A is a
  1221. formatted string with a newline at the end.) For example, the
  1222. following routine prints the elements of a list, N elements per line,
  1223. and then prints the total number of elements on a new line:
  1224.  
  1225.    (defun print-list (list &optional (elements-per-line 10))
  1226.      (fresh-line)
  1227.      (loop for i upfrom 1
  1228.            for element in list do
  1229.        (format t "~A ~:[~;~%~]" element (zerop (mod i elements-per-line))))
  1230.      (format t "~&~D~%" (length list)))
  1231.  
  1232. ----------------------------------------------------------------
  1233.  
  1234. ;;; *EOF*
  1235.