See reader questions & answers on this topic! - Help others by sharing your knowledge
;;; **************************************************************** ;;; Answers to Frequently Asked Questions about Lisp *************** ;;; **************************************************************** ;;; Written by Mark Kantrowitz and Barry Margolin ;;; lisp_1.faq This post contains Part 1 of the Lisp FAQ. If you think of questions that are appropriate for this FAQ, or would like to improve an answer, please send email to us at firstname.lastname@example.org. 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; use either the email@example.com mailing list or the comp.lang.lisp newsgroup for that. If a question appears frequently in one of those forums, it will get added to the FAQ list. *** Copyright: Copyright (c) 1992-94 by Mark Kantrowitz and Barry Margolin. All rights reserved. This FAQ may be freely redistributed in its entirety without modification provided that this copyright notice is not removed. It may not be sold for profit or incorporated in commercial documents (e.g., published for sale on CD-ROM, floppy disks, books, magazines, or other print form) without the prior written permission of the copyright holder. Permission is expressly granted for this document to be made available for file transfer from installations offering unrestricted anonymous file transfer on the Internet. If this FAQ is reproduced in offline media (e.g., CD-ROM, print form, etc.), a complimentary copy should be sent to Mark Kantrowitz, School of Computer Science, Carnegie Mellon University, 5000 Forbes Avenue, Pittsburgh, PA 15213-3891 USA. This article is provided AS IS without any express or implied warranty. *** Recent Changes: ;;; 1.54: ;;; 8-MAR-95 mk Removed the CORBA entry from part 5 of the FAQ, since ;;; Donald Vines is no longer at NEC. Thus there's nobody at ;;; NEC to provide support for the CLOS binding. ;;; 10-MAR-95 mk Added Xgcl entry to part 7. ;;; ;;; 1.55: ;;; 13-MAR-95 mk Added 800 number for Blackboard Technology Group. ;;; ;;; 1.56: ;;; 14-APR-95 mk Updated DTP entry. ;;; ;;; 1.57: ;;; 1-MAY-95 mk Added environment variable access to [2-11]. ;;; ;;; 1.58: ;;; 29-AUG-95 mk Added entry on CL-Grasper, the SRI Grapher, to [7-2]. ;;; ;;; 1.59: ;;; 13-SEP-95 mk Updated WOOD entry. ;;; ;;; 1.60: ;;; 9-NOV-95 mk Updated info on ISO Lisp in [4-10]. ;;; 14-NOV-95 mk Updated Allegro CL entry, and added entry on Allegro CL 3.0 ;;; Web Version for Windows to [4-0]. ;;; 20-FEB-96 mk ftp.uu.net:/vendor/franz/ --> ftp.franz.com:/pub/ ;;; 1-MAY-96 mk Updated MCL entry in part 4. ;;; 14-MAR-97 mk Updated MCL information. *** Topics Covered: 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] Lisp books, introductions, documentation, periodicals, journals, and conference proceedings. [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 is the "minimal" set of primitives needed for a Lisp interpreter? [1-6] What does CLOS, PCL, X3J13, CAR, CDR, ... mean? [1-7] 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? How do I exit Lisp? Access environment variables? [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)? [2-21] How do I tell if a symbol names a function and not a macro? 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] Where can I get a copy of the ANSI Common Lisp standard? What is ISO Lisp? Object-oriented Programming in Lisp (Part 5): [5-0] What is CLOS (PCL) and where can I get it? How do you pronounce CLOS? What is the Meta-Object Protocol (MOP)? [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? (Persistent Object Storage) [5-5] Given the name of a class, how can I get the names of its slots? [5-6] Free CLOS software. [5-7] Common CLOS Blunders 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 LaTeX (WEB and other literate programming tools) [6-7] Where can I get an implementation of Prolog in Lisp? [6-8] World-Wide Web (WWW) Resources 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. *** 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 FAQ is available via anonymous FTP from CMU: To obtain the files from CMU, connect by anonymous FTP to ftp.cs.cmu.edu:/user/ai/pubs/faqs/lisp/ [126.96.36.199] using username "anonymous" and password "name@host" (substitute your email address) or via AFS in the Andrew File System directory /afs/cs.cmu.edu/project/ai-repository/ai/pubs/faqs/lisp/ and get the files lisp_1.faq, lisp_2.faq, lisp_3.faq, lisp_4.faq, lisp_5.faq, lisp_6.faq and lisp_7.faq. You can also obtain a copy of the FAQ by sending a message to firstname.lastname@example.org with Send Lisp FAQ in the message body. The FAQ postings are also archived in the periodic posting archive on rtfm.mit.edu:/pub/usenet/news.answers/lisp-faq/ [188.8.131.52] If you do not have anonymous ftp access, you can access the archive by mail server as well. Send an E-mail message to email@example.com with "help" and "index" in the body on separate lines for more information. An automatically generated HTML version of the Lisp FAQ is accessible by WWW as part of the AI-related FAQs Mosaic page. The URL for this resource is http://www.cs.cmu.edu/Web/Groups/AI/html/faqs/top.html The direct URL for the Lisp FAQ is http://www.cs.cmu.edu/Web/Groups/AI/html/faqs/lang/lisp/top.html 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 LOOP macro will be referred to separately. If you need to cite the FAQ for some reason, use the following format: Mark Kantrowitz and Barry Margolin, "Answers to Frequently Asked Questions about Lisp", comp.lang.lisp, <month>, <year>, ftp.cs.cmu.edu:/user/ai/pubs/faqs/lisp/lisp_?.faq, firstname.lastname@example.org.