home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / lisp-faq / part2 < prev    next >
Internet Message Format  |  1997-08-13  |  50KB

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!newsxfer3.itd.umich.edu!iagnet.net!204.71.1.61!news-out.internetmci.com!infeed2.internetmci.com!newsfeed.internetmci.com!nntp.info.ucla.edu!nntp.club.cc.cmu.edu!cantaloupe.srv.cs.cmu.edu!mkant
  2. From: mkant+@cs.cmu.edu (Mark Kantrowitz)
  3. Newsgroups: comp.lang.lisp,news.answers,comp.answers
  4. Subject: FAQ: Lisp Frequently Asked Questions 2/7 [Monthly posting]
  5. Supersedes: <LISP_2_868777228@CS.CMU.EDU>
  6. Followup-To: poster
  7. Date: 13 Aug 1997 07:03:59 GMT
  8. Organization: Carnegie-Mellon University, School of Computer Science
  9. Lines: 991
  10. Approved: news-answers-request@MIT.Edu
  11. Distribution: world
  12. Expires: 24 Sep 1997 07:00:20 GMT
  13. Message-ID: <LISP_2_871455620@CS.CMU.EDU>
  14. References: <LISP_1_871455620@CS.CMU.EDU>
  15. Reply-To: ai+lisp-faq@cs.cmu.edu
  16. NNTP-Posting-Host: glinda.oz.cs.cmu.edu
  17. Summary: Frequently asked questions about Lisp -- General Questions
  18. Xref: senator-bedfellow.mit.edu comp.lang.lisp:28923 news.answers:109633 comp.answers:27541
  19.  
  20. Archive-name: lisp-faq/part2
  21. Last-Modified: Tue Feb 20 13:29:08 1996 by Mark Kantrowitz
  22. Version: 1.54
  23. Maintainer: Mark Kantrowitz and Barry Margolin <ai+lisp-faq@cs.cmu.edu>
  24. URL: http://www.cs.cmu.edu/Web/Groups/AI/html/faqs/lang/lisp/top.html
  25. Size: 49548 bytes, 999 lines
  26.  
  27. ;;; ****************************************************************
  28. ;;; Answers to Frequently Asked Questions about Lisp ***************
  29. ;;; ****************************************************************
  30. ;;; Written by Mark Kantrowitz and Barry Margolin
  31. ;;; lisp_2.faq 
  32.  
  33. This post contains Part 2 of the Lisp FAQ.
  34.  
  35. If you think of questions that are appropriate for this FAQ, or would
  36. like to improve an answer, please send email to us at ai+lisp-faq@cs.cmu.edu.
  37.  
  38. Topics Covered (Part 2):
  39.  
  40.   [2-1]   Is there a GNU-Emacs interface to Lisp?
  41.   [2-2]   When should I use a hash table instead of an association list?
  42.   [2-3]   What is the equivalent of EXPLODE and IMPLODE in Common Lisp?
  43.   [2-4]   Is Lisp inherently slower than more conventional languages such as C?
  44.   [2-5]   Why does Common Lisp have "#'"?
  45.   [2-6]   How do I call non-Lisp functions from Lisp?
  46.   [2-7]   Can I call Lisp functions from other languages?
  47.   [2-8]   I want to call a function in a package that might not exist at
  48.           compile time. How do I do this?  
  49.   [2-9]   What is CDR-coding?
  50.   [2-10]  What is garbage collection?
  51.   [2-11]  How do I save an executable image of my loaded Lisp system?
  52.           How do I run a Unix command in my Lisp? How do I exit Lisp?
  53.           Access environment variables?
  54.   [2-12]  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-13]  History: Where did Lisp come from?
  58.   [2-14]  How do I find the argument list of a function?
  59.           How do I get the function name from a function object?
  60.   [2-15]  How can I have two Lisp processes communicate via unix sockets?
  61.   [2-16]  How can I create a stream that acts like UNIX's /dev/null
  62.           (i.e., gobbles any output and immediately signals EOF on
  63.           input operations)?
  64.   [2-17]  Read-time conditionalization of code (#+ #- and *features*)   
  65.   [2-18]  What reader macro characters are used in major Lisp systems?
  66.   [2-19]  How do I determine if a file is a directory or not? 
  67.           How do I get the current directory name from within a Lisp 
  68.           program? Is there any way to create a directory?
  69.   [2-20]  What is a "Lisp Machine" (LISPM)?
  70.   [2-21]  How do I tell if a symbol names a function and not a macro?
  71.  
  72. Search for \[#\] to get to question number # quickly.
  73.  
  74. ----------------------------------------------------------------
  75. Subject: [2-1] Is there a GNU-Emacs interface to Lisp?
  76.  
  77. ILISP is a powerful GNU-Emacs interface to many dialects of Lisp,
  78. including Lucid, Allegro, {A}KCL, IBCL, and CMU.  Written by Chris
  79. McConnell <ccm+@cs.cmu.edu> and now maintained by Marco Antoniotti
  80. <marcoxa@cs.nyu.edu> and Rick Busdiecker <rfb@lehman.com>.  It is
  81. available by anonymous ftp from
  82.    h.gp.cs.cmu.edu:/usr/rfb/ilisp/ [128.2.254.156]
  83. as the file ilisp-5.6.tar.gz.  It is also available in the CMU AI
  84. Repository in
  85.    ftp.cs.cmu.edu:/user/ai/lang/lisp/util/emacs/ilisp/
  86. If you want to be on the ilisp mailing list, to hear about new
  87. releases and patches, send mail to ilisp-request@lehman.com.  Please
  88. send any comments, code, or bug reports to ilisp@lehman.com.
  89.  
  90. Franz Inc.'s GNU-Emacs/Lisp interface includes an online Common Lisp
  91. manual. (The manual is available by license from Franz Inc. Contact
  92. info@franz.com for more information.) The Emacs-Lisp interface
  93. (without the online Common Lisp reference manual and some
  94. Allegro-specific code) is available free from
  95.    ftp.franz.com:/pub/emacs/eli-2.0.11.tar.gz
  96. and takes advantage of GNU-Emacs 19.X's newest features, including
  97. support for mouse input, pulldown menus, and multifont text. The
  98. interface also supports Epoch 3.2 and 4.2, and LEmacs 19.6 and 19.8.
  99. For discussion of the Franz lisp-emacs interface, join the
  100. allegro-cl-request@cs.berkeley.edu mailing list.
  101. (See also [1-2] for a hardcopy version of the Common Lisp reference manual.)
  102.  
  103. The cl-shell package provides a major mode (cl-shell-mode) for running
  104. Common Lisp (CL) as an Emacs subprocess.  It provides a general
  105. mechanism for communication between CL and Emacs which does not rely
  106. on extra processes, and should therefore be easily portable to any
  107. version of CL.  Features include direct (i.e., not through a temp file)
  108. evaluation and in-package compilation of forms from lisp-mode buffers,
  109. type-ahead and a history mechanism for the cl-shell buffer, and pop-up
  110. help facilities for the CL functions documentation, macroexpand and
  111. describe.  Extensions for Lucid Common Lisp provide pop-up arglists
  112. and source file editing.  Other extensions are provided to allow
  113. editing source files of CLOS or Flavors methods.  Cl-shell is
  114. available on the Lucid tape (in the goodies directory) or via
  115. anonymous ftp from whitechapel.media.mit.edu (18.85.0.125).
  116.  
  117. Lucid includes some other Emacs-Lisp interfaces in its goodies directory.
  118.  
  119. Harlequin's LispWorks includes an Emacs-Lisp interface.
  120.  
  121. Venue's Medley has an optional EMACS Interface.
  122.  
  123. GNU-Emacs itself is available by anonymous ftp from prep.ai.mit.edu.
  124.  
  125. Edebug, a debugger for Emacs Lisp, and some utilities for Common Lisp
  126. debugging (Dave Gillespie's version of cl.el) are available by
  127. anonymous ftp from 
  128.    a.cs.uiuc.edu:/pub/edebug/
  129. To join the Edebug mailing list edebug@cs.uiuc.edu send mail to 
  130. edebug-request@cs.uiuc.edu. For more information, write to Daniel
  131. LaLiberte <liberte@cs.uiuc.edu>. 
  132.  
  133. ----------------------------------------------------------------
  134. Subject: [2-2] When should I use a hash table instead of an association list?
  135.  
  136. Both association lists (alists) and hash tables may be used to
  137. represent tabular data. Hash tables have an O(1) running time and
  138. alists an O(n) running time, so hash tables are ultimately more
  139. efficient than alists. However, if the alists are small, they can be
  140. more efficient than hash tables, which have a large initial overhead.
  141.  
  142. Alists can sometimes be more efficient if the keys are sorted
  143. according to frequency, with the most heavily accessed keys appearing
  144. at the front of the list. But one doesn't always know this kind of
  145. information, and even then the frequency distribution may be flat.
  146.  
  147. In Allegro CL 4.1 [SPARC; R1], the rule of thumb is that for less than
  148. 24 elements, linear search using alists beats hashing.  In Lucid CL
  149. 4.0.1 HP 9000/700, the break-even point is at 10 elements. The
  150. break-even points vary in other lisps from as low as 4 elements to as
  151. high as 100 elements. So if you're using alists in your code, using 
  152. hash tables instead may speed up your program. 
  153.  
  154. A potential problem may occur, however, when the keys of an EQ or EQL
  155. hash table are Lisp objects such as conses or arrays (or other objects
  156. that are identified by their addresses). In most implementations, such
  157. tables must be re-hashed after garbage collection. If your application
  158. causes frequent GCs, this can adversely affect the performance of hash
  159. table lookup. Since EQL-hashing and =-hashing of fixnums generally
  160. don't require rehashing after GC, one way of avoiding this problem is
  161. to include a unique identifier in each key object and hash on that
  162. instead. Another solution is to use an EQUAL hash table if the keys
  163. are conses or an EQUALP hash table if the keys are arrays or other
  164. (non-circular!) structures.
  165.  
  166. ----------------------------------------------------------------
  167. Subject: [2-3] What is the equivalent of EXPLODE and IMPLODE in Common Lisp?
  168.  
  169. Hopefully, the only reason you need to do this is as part of trying to port
  170. some old MacLisp code to Common Lisp.  These functions predated the
  171. inclusion of strings as a first-class data type in Lisp; symbols were used
  172. as strings, and they ere EXPLODEd to allow the individual characters to be
  173. manipulated in a list.
  174.  
  175. Probably the best approximations of these are:
  176.  
  177.    (defun explode (object)
  178.      (loop for char across (prin1-to-string object)
  179.            collect (intern (string char))))
  180.  
  181.    (defun implode (list)
  182.      (read-from-string (coerce (mapcar #'character list) 'string)))
  183.  
  184. An alternate definition of EXPLODE which uses MAP instead of LOOP is:
  185.  
  186.    (defun explode (object)
  187.      (map 'list #'(lambda (char) 
  188.                     (intern (string char)))
  189.           (prin1-to-string object)))
  190.  
  191. The creation of N conses of garbage to process a string of N
  192. characters is a hideously inefficient way of doing the job.  Rewrite
  193. EXPLODE code with PRIN1-TO-STRING, or better STRING if the arguments
  194. are symbols without funny characters.  For IMPLODE, try to make its
  195. caller use strings and try to make the result usable as a string to
  196. avoid having to call INTERN or READ-FROM-STRING.
  197.  
  198. ----------------------------------------------------------------
  199. Subject: [2-4] Is Lisp inherently slower than more conventional languages
  200.                such as C?
  201.  
  202. This is a tough question to answer, as you probably expected.  In many
  203. cases, it appears to be.  Lisp does not require the programmer to specify
  204. the data type of variables, so generic arithmetic operators may have to
  205. perform type checking at runtime in order to determine how to proceed.
  206. However, Lisp code can also be denser (i.e.  there is more expressed in a
  207. single line) than many other languages: the Lisp expression (+ A B) is more
  208. powerful than the C expression A+B (the Lisp version supports bignums,
  209. rationals, and complex numbers, while the C version only supports
  210. limited-size integers and floating point); therefore, one may claim that it
  211. is reasonable that the Lisp version take longer than the C version (but
  212. don't expect everyone to accept this rationalization).  Solutions to this
  213. include hardware support (e.g. processors that support type tags in data,
  214. such as SPARC and Symbolics Lisp Machines), declarations, and specialized
  215. variants of functions (e.g. in MacLisp, + accepts and returns only fixnums,
  216. +$ accepts and returns only flonums, and PLUS is generic).
  217.  
  218. At one time, the MIT PDP-10 MacLisp compiler was compared to DEC's
  219. PDP-10 Fortran compiler.  When appropriate declarations were supplied
  220. in the Lisp code, the performance of compiled Lisp arithmetic rivaled
  221. that of the Fortran code.  It would hardly be fair to compare Lisp
  222. without declarations to Fortran, since the Fortran compiler would have
  223. more information upon which it could base its optimizations. A more
  224. recent test found that numeric code compiled with optimizations using
  225. CMU CL is within the same ballpark as highly optimized Fortran code.
  226. For unoptimized Fortran code, CMU CL was about 4 times faster.
  227. Even the speed of numeric code generated by other Lisp compilers
  228. (AKCL, Allegro, Lucid) was well within an order of magnitude of good
  229. Fortran and C compilers (although slower than CMU CL).  Inspection of
  230. the emitted C code from AKCL doesn't reveal many obvious sources of
  231. inefficiency. (Since AKCL compiles Lisp into C, there are many cases
  232. where KCL code is as fast as hand-written C code.)
  233.  
  234. See the paper peoplesparc.berkeley.edu:/pub/papers/fastlisp.ps.Z
  235. for a discussion of the speed of Lisp vis a vis Fortran or C.
  236.  
  237. Since Lisp is a good language for rapid prototyping, it is easy for a
  238. mediocre programmer (or even a good programmer, who isn't being careful) to
  239. generate a large amount of inefficient Lisp code. A good example is the use
  240. of APPEND to link successive lists together, instead of keeping a pointer
  241. to the tail of the list. Often a programmer can obtain significant
  242. speed increases by using a time/space profiler to identify the
  243. functions which waste time (often small functions which are called
  244. frequently) and rewriting those functions.
  245.      
  246. ----------------------------------------------------------------
  247. Subject: [2-5] Why does Common Lisp have "#'"?
  248.  
  249. #' is a macro-character which expands #'FOO to (FUNCTION FOO).  Symbols in
  250. Lisp have two bindings, one for values and one for functions, allowing them
  251. to represent both variables and functions, depending on context. #'FOO
  252. accesses FOO's lexical function binding in a context where the value
  253. interpretation would normally occur.  #' is also used to create lexical
  254. closures for lambda expressions. A lexical closure is a function which when
  255. invoked executes the body of the lambda-expression in the lexical
  256. environment within which the closure was created.  See pp. 115-117 of CLtL2
  257. for more details.
  258.  
  259. ----------------------------------------------------------------
  260. Subject: [2-6] How do I call non-Lisp functions from Lisp?
  261.  
  262. Most Lisp implementations for systems where Lisp is not the most common
  263. language provide a "foreign function" interface.  As of now there has been
  264. no significant standardization effort in this area.  They tend to be
  265. similar, but there are enough differences that it would be inappropriate to
  266. try to describe them all here.  In general, one uses an
  267. implementation-dependent macro that defines a Lisp function, but instead of
  268. supplying a body for the function, one supplies the name of a function written
  269. in another language; the argument list portion of the definition is
  270. generally augmented with the data types the foreign function expects and
  271. the data type of the foreign function's return value, and the Lisp
  272. interface function arranges to do any necessary conversions.  There is also
  273. generally a function to "load" an object file or library compiled in a
  274. foreign language, which dynamically links the functions in the file being
  275. loaded into the address space of the Lisp process, and connects the
  276. interface functions to the corresponding foreign functions.
  277.  
  278. If you need to do this, see the manual for your language implementation for
  279. full details.  In particular, be on the lookout for restrictions on the
  280. data types that may be passed.  You may also need to know details about the
  281. linkage conventions that are used on your system; for instance, many C
  282. implementations prepend an underscore onto the names of C functions when
  283. generating the assembler output (this allows them to use names without
  284. initial underscores internally as labels without worrying about conflicts),
  285. and the foreign function interface may require you to specify this form
  286. explicitly.
  287.  
  288. Franz Allegro Common Lisp's "Foreign Function Call Facility" is
  289. described in chapter 10 of the documentation. Calling Lisp Functions
  290. from C is treated in section 10.8.2. The foreign function interface in
  291. Macintosh Common Lisp is similar. The foreign function interface for
  292. KCL is described in chapter 10 of the KCL Report. The foreign function
  293. interfaces for Lucid on the Vax and Lucid on the Sun4 are
  294. incompatible. Lucid's interface is described in chapter 5 of the
  295. Advanced User's Guide.
  296.  
  297. ----------------------------------------------------------------
  298. Subject: [2-7] Can I call Lisp functions from other languages?
  299.  
  300. In implementations that provide a foreign function interface as described
  301. above, there is also usually a "callback" mechanism.  The programmer may
  302. associate a foreign language function name with a Lisp function.  When a
  303. foreign object file or library is loaded into the Lisp address space, it is
  304. linked with these callback functions.  As with foreign functions, the
  305. programmer must supply the argument and result data types so that Lisp may
  306. perform conversions at the interface. Note that in such foreign function
  307. interfaces Lisp is often left "in control" of things like memory
  308. allocation, I/O channels, and startup code (this is a major nuisance
  309. for lots of people).
  310.      
  311. ----------------------------------------------------------------
  312.  
  313. Subject: [2-8]  I want to call a function in a package that might not exist at
  314.                 compile time. How do I do this?
  315.  
  316. Use (funcall (find-symbol "SYMBOL-NAME" :pkg-name) ...).
  317.  
  318. ----------------------------------------------------------------
  319. Subject: [2-9]  What is CDR-coding?
  320.  
  321. CDR-coding is a space-saving way to store lists in memory.  It is normally
  322. only used in Lisp implementations that run on processors that are
  323. specialized for Lisp, as it is difficult to implement efficiently
  324. in software.  In normal list structure, each element of the
  325. list is represented as a CONS cell, which is basically two pointers (the
  326. CAR and CDR); the CAR points to the element of the list, while the CDR
  327. points to the next CONS cell in the list or NIL.  CDR-coding takes
  328. advantage of the fact that most CDR cells point to another CONS, and
  329. further that the entire list is often allocated at once (e.g. by a call to
  330. LIST).  Instead of using two pointers to implement each CONS cell, the CAR
  331. cell contains a pointer and a two-bit "CDR code".  The CDR code may contain
  332. one of three values: CDR-NORMAL, CDR-NEXT, and CDR-NIL.  If the code is
  333. CDR-NORMAL, this cell is the first half of an ordinary CONS cell pair, and
  334. the next cell in memory contains the CDR pointer as described above.  If
  335. the CDR code is CDR-NEXT, the next cell in memory contains the next CAR
  336. cell; in other words, the CDR pointer is implicitly thisaddress+1, where
  337. thisaddress is the memory address of the CAR cell.  If the CDR code is
  338. CDR-NIL, then this cell is the last element of the list; the CDR pointer is
  339. implicitly a reference to the object NIL.  When a list is constructed
  340. incrementally using CONS, a chain of ordinary pairs is created; however,
  341. when a list is constructed in one step using LIST or MAKE-LIST, a block of
  342. memory can be allocated for all the CAR cells, and their CDR codes all set
  343. to CDR-NEXT (except the last, which is CDR-NIL), and the list will only
  344. take half as much storage (because all the CDR pointers are implicit).
  345.  
  346. If this were all there were to it, it would not be difficult to implement
  347. in software on ordinary processors; it would add a small amount of overhead
  348. to the CDR function, but the reduction in paging might make up for it.  The
  349. problem arises when a program uses RPLACD on a CONS cell that has a CDR
  350. code of CDR-NEXT or CDR-NIL.  Normally RPLACD simply stores into the CDR
  351. cell of a CONS, but in this case there is no CDR cell -- its contents are
  352. implicitly specified by the CDR code, and the word that would normally
  353. contain the CDR pointer contains the next CONS cell (in the CDR-NEXT case)
  354. to which other data structures may have pointers, or the first word of some
  355. other object (in the CDR-NIL case).  When CDR-coding is used, the
  356. implementation must also provide automatic "forwarding pointers"; an
  357. ordinary CONS cell is allocated, the CAR of the original cell is copied
  358. into its CAR, the value being RPLACD'ed is stored into its CDR, and the old
  359. CAR cell is replaced with a forwarding pointer to the new CONS cell.
  360. Whenever CAR or CDR is performed on a CONS, it must check whether the
  361. location contains a forwarding pointer.  This overhead on both CAR and CDR,
  362. coupled with the overhead on CDR to check for CDR codes, is generally
  363. enough that using CDR codes on conventional hardware is infeasible.
  364.  
  365. There is some evidence that CDR-coding doesn't really save very much
  366. memory, because most lists aren't constructed at once, or RPLACD is done on
  367. them enough that they don't stay contiguous.  At best this technique can
  368. save 50% of the space occupied by CONS cells. However, the savings probably
  369. depends to some extent upon the amount of support the implementation
  370. provides for creating CDR-coded lists.  For instance, many system functions
  371. on Symbolics Lisp Machines that operate on lists have a :LOCALIZE option;
  372. when :LOCALIZE T is specified, the list is first modified and then copied
  373. to a new, CDR-coded block, with all the old cells replaced with forwarding
  374. pointers.  The next time the garbage collector runs, all the forwarding
  375. pointers will be spliced out.  Thus, at a cost of a temporary increase in
  376. memory usage, overall memory usage is generally reduced because more lists
  377. may be CDR-coded. There may also be some benefit in improved paging
  378. performance due to increased locality as well (putting a list into
  379. CDR-coded form makes all the "cells" contiguous). Nevertheless, modern
  380. Lisps tend to use lists much less frequently, with a much heavier
  381. reliance upon code, strings, and vectors (structures).
  382.  
  383. ----------------------------------------------------------------
  384. Subject: [2-10] What is garbage collection?
  385.  
  386. Garbage Collection (GC) refers to the automatic storage allocation
  387. mechanisms present in many Lisps. There are several kinds of storage
  388. allocation algorithms, but most fall within two main classes:
  389.  
  390.    1. Stop and Copy. Systems which copy active objects from "old"
  391.       storage to "new" storage and then recycle the old storage.
  392.  
  393.    2. Mark and Sweep. Systems which link together storage
  394.       used by discarded objects. 
  395.  
  396. Generational scavenging garbage collection (aka emphemeral GC) is a
  397. variation in which memory is allocated in layers, with tenured
  398. (long-lived) objects in the older layers. Rather than doing a full GC
  399. of all of memory every time more room is needed, only the last few
  400. layers are GCed during an ephemeral GC, taking much less time.
  401. Short-lived objects are quickly recycled, and full GCs are then much
  402. less frequent. It is most often used to improve the performance of
  403. stop and copy garbage collectors.  It is possible to implement
  404. ephemeral GC in mark and sweep systems, just much more difficult.
  405.  
  406. Stop and copy garbage collection provides simpler storage allocation,
  407. avoids fragmentation of memory (intermixing of free storage with used
  408. storage). Copying, however, consumes more of the address space, since up to
  409. half the space must be kept available for copying all the active objects.
  410. This makes stop and copy GC impractical for systems with a small address
  411. space or without virtual memory.  Also, copying an object requires that you
  412. track down all the pointers to an object and update them to reflect the new
  413. address, while in a non-copying system you need only keep one pointer to an
  414. object, since its location will not change. It is also more difficult to
  415. explicitly return storage to free space in a copying system.
  416.  
  417. Garbage collection is not part of the Common Lisp standard. Most Lisps
  418. provide a function ROOM which provides human-readable information about the
  419. state of storage usage. In many Lisps, (gc) invokes an ephemeral garbage
  420. collection, and (gc t) a full garbage collection.
  421.  
  422. ----------------------------------------------------------------
  423. Subject: [2-11] How do I save an executable image of my loaded Lisp system?
  424.                 How do I run a Unix command in my Lisp? How do I exit Lisp?
  425.                 Access environment variables?
  426.  
  427. There is no standard for dumping a Lisp image. Here are the
  428. commands from some lisp implementations:
  429.    Lucid:               DISKSAVE
  430.    Symbolics:           Save World  [CP command]
  431.    CMU CL:              SAVE-LISP
  432.    Franz Allegro:       EXCL:DUMPLISP (documented) 
  433.                         SAVE-IMAGE (undocumented)
  434.    Medley:              IL:SYSOUT or IL:MAKESYS
  435.    MCL:                 SAVE-APPLICATION <pathname>
  436.                           &key :toplevel-function  :creator :excise-compiler
  437.                           :size :resources :init-file :clear-clos-caches
  438.    KCL:                 (si:save-system "saved_kcl")
  439.    LispWorks:        LW:SAVE-IMAGE
  440. Be sure to garbage collect before dumping the image. You may need to
  441. experiment with the kind of garbage collection for large images, and
  442. may find better results if you build the image in stages.
  443.  
  444. There is no standard for running a Unix shell command from Lisp,
  445. especially since not all Lisps run on top of Unix. Here are the
  446. commands from some Lisp implementations:
  447.    Allegro:             EXCL:RUN-SHELL-COMMAND (command &key input output
  448.                                   error-output wait if-input-does-not-exist
  449.                                   if-output-exists if-error-output-exists)
  450.    Lucid:               RUN-PROGRAM (name 
  451.                                      &key input output
  452.                                           error-output (wait t) arguments
  453.                                           (if-input-does-not-exist :error)
  454.                                           (if-output-exists :error)
  455.                                           (if-error-output-exists :error))
  456.    KCL:                 SYSTEM 
  457.                         For example, (system "ls -l").
  458.                         You can also try RUN-PROCESS and EXCLP, but they
  459.                         don't work with all versions of KCL.
  460.    CMU CL:              RUN-PROGRAM (program args
  461.                &key (env *environment-list*) (wait t) pty input
  462.                if-input-does-not-exist output
  463.                (if-output-exists :error) (error :output) 
  464.                (if-error-exists :error) status-hook before-execve)
  465.    LispWorks:           FOREIGN:CALL-SYSTEM-SHOWING-OUTPUT
  466.  
  467. To toggle source file recording and cross-reference annotations, use
  468.    Allegro:             excl:*record-source-file-info*
  469.             excl:*load-source-file-info* 
  470.             excl:*record-xref-info*
  471.             excl:*load-xref-info*
  472.    LispWorks:           (toggle-source-debugging nil)
  473.  
  474. Memory management:
  475.    CMU CL:              (bytes-consed-between-gcs)  [this is setfable]
  476.    Lucid:        (change-memory-management 
  477.                      &key growth-limit expand expand-reserved)
  478.    Allegro:        *tenured-bytes-limit*
  479.    LispWorks:           LW:GET-GC-PARAMETERS
  480.                         (use LW:SET-GC-PARAMETERS to change them)
  481.  
  482. Environment Variable Access:
  483.    Allegro:             (sys:getenv var)
  484.                         (sys:setenv var value) or (setf (sys:getenv var) value)
  485.    Lucid:               (environment-variable var)
  486.                         (set-environment-variable var value)
  487.    CMU CL 17:           (cdr (assoc (intern var :keyword) *environment-list*))
  488.    {A}KCL, GCL:         (system:getenv var)
  489.    CLISP:               (system::getenv var)
  490.  
  491. Exiting/Quitting:
  492.    CLISP:               EXIT
  493.    Allegro:             EXIT (&optional excl::code &rest excl::args
  494.                               &key excl::no-unwind excl::quiet)
  495.    LispWorks:           BYE (&optional (arg 0))
  496.    Lucid:               QUIT (&optional (lucid::status 0))
  497.    CMU CL:              QUIT (&optional recklessly-p)
  498.  
  499. ----------------------------------------------------------------
  500. Subject: [2-12] I'm porting some code from a Symbolics Lisp machine to some
  501.                 other platform, and there are strange characters in the code.
  502.                 What do they mean?
  503.  
  504. The Symbolics Zetalisp character set includes the following
  505. characters not present in other Lisps (^ means control):
  506.    ^]      >=      greater than or equal to
  507.    ^\      <=      less than or equal to
  508.    ^Z      !=      not equal to
  509.    ^^      ==      equivalent to 
  510.    ^E      not
  511.    ^G      pi
  512.    ^L      +/-     plus/minus
  513.    ^H      lambda
  514.    ^F      epsilon
  515.    ^W      <-->    left/right arrow
  516.    ^X      <--     left arrow
  517.    ^Y      -->     right arrow
  518.    ^A              down arrow
  519.    ^K              up arrow
  520.    ^D              up caret
  521.    ^_              down caret
  522.    ^T              forall
  523.    ^U              there exists
  524.    ^B              alpha
  525.    ^C              beta
  526.    ^I              gamma
  527.    ^J              delta
  528.    ^O              partial delta  
  529.    ^N              infinity
  530.    ^M              circle +
  531.    ^V              circle x
  532.  
  533. Other special characters to look out for are the font-change characters,
  534. which are represented as a ^F followed by a digit or asterisk. A digit
  535. means to push font #N onto the stack; an asterisk means to pop the most
  536. recent font from the stack. You can clean up the code by replacing "\^F."
  537. with "". In format statements, ^P and ^Q are used to delimit text to
  538. be printed in a particular character style.
  539.      
  540. ----------------------------------------------------------------
  541. Subject: [2-13] History: Where did Lisp come from?
  542.  
  543. John McCarthy developed the basics behind Lisp during the 1956 Dartmouth
  544. Summer Research Project on Artificial Intelligence.  He intended it as an
  545. algebraic LISt Processing (hence the name) language for artificial
  546. intelligence work. Early implementations included the IBM 704, the IBM
  547. 7090, the DEC PDP-1, the DEC PDP-6 and the DEC PDP-10. The PDP-6 and
  548. PDP-10 had 18-bit addresses and 36-bit words, allowing a CONS cell to
  549. be stored in one word, with single instructions to extract the CAR and
  550. CDR parts. The early PDP machines had a small address space, which
  551. limited the size of Lisp programs. 
  552.  
  553. Milestones in the development of Lisp:
  554.  
  555.    1956            Dartmouth Summer Research Project on AI.
  556.  
  557.    1960-65         Lisp1.5 is the primary dialect of Lisp.
  558.  
  559.    1964-           Development of BBNLisp at BBN.
  560.  
  561.    late 60s        Lisp1.5 diverges into two main dialects:
  562.                    Interlisp (originally BBNLisp) and MacLisp.
  563.  
  564.    early 70s       Development of special-purpose computers known as Lisp
  565.                    Machines, designed specificly to run Lisp programs. 
  566.                    Xerox D-series Lisp Machines run Interlisp-D. 
  567.                    Early MIT Lisp Machines run Lisp Machine Lisp 
  568.                    (an extension of MacLisp).
  569.  
  570.    1969            Anthony Hearn and Martin Griss define Standard Lisp to
  571.                    port REDUCE, a symbolic algebra system, to a variety
  572.                    of architectures.  
  573.  
  574.    late 70s        Macsyma group at MIT developed NIL (New Implementation
  575.                    of Lisp), a Lisp for the VAX.
  576.  
  577.                    Stanford and Lawrence Livermore National Laboratory
  578.                    develop S-1 Lisp for the Mark IIA supercomputer.
  579.  
  580.                    Franz Lisp (dialect of MacLisp) runs on stock-hardware
  581.                    Unix machines.
  582.  
  583.                    Gerald J. Sussman and Guy L. Steele developed Scheme,
  584.                    a simple dialect of Lisp with lexical scoping and
  585.                    lexical closures, continuations as first-class objects,
  586.                    and a simplified syntax (i.e., only one binding per symbol).
  587.  
  588.                    Advent of object-oriented programming concepts in Lisp.
  589.                    Flavors was developed at MIT for the Lisp machine,
  590.                    and LOOPS (Lisp Object Oriented Programming System) was
  591.                    developed at Xerox. 
  592.  
  593.    early 80s       Development of SPICE-Lisp at CMU, a dialect of MacLisp
  594.                    designed to run on the Scientific Personal Integrated
  595.                    Computing Environment (SPICE) workstation.
  596.  
  597.    1980            First biannual ACM Lisp and Functional Programming Conf.
  598.  
  599.    1981            PSL (Portable Standard Lisp) runs on a variety of platforms.
  600.  
  601.    1981+           Lisp Machines from Xerox, LMI (Lisp Machines Inc) 
  602.                    and Symbolics available commercially.
  603.  
  604.    April 1981      Grass roots definition of Common Lisp as a description
  605.                    of the common aspects of the family of languages (Lisp
  606.                    Machine Lisp, MacLisp, NIL, S-1 Lisp, Spice Lisp, Scheme). 
  607.                    
  608.  
  609.    1984            Publication of CLtL1. Common Lisp becomes a de facto 
  610.                    standard.
  611.  
  612.    1986            X3J13 forms to produce a draft for an ANSI Common Lisp
  613.                    standard. 
  614.  
  615.    1987            Lisp Pointers commences publication.
  616.  
  617.    1990            Steele publishes CLtL2 which offers a snapshot of
  618.                    work in progress by X3J13.  (Unlike CLtL1, CLtL2
  619.                    was NOT an output of the standards process and was
  620.                    not intended to become a de facto standard.  Read
  621.                    the Second Edition Preface for further explanation
  622.                    of this important issue.) Includes CLOS,
  623.                    conditions, pretty printing and iteration facilities. 
  624.  
  625.    1992            X3J13 creates a draft proposed American National
  626.                    Standard for Common Lisp. This document is the
  627.                    first official successor to CLtL1. 
  628.  
  629. [Note: This summary is based primarily upon the History section of the
  630. draft ANSI specification. More detail and references can be obtained from
  631. that document. See [4-12] for information on obtaining a copy.]
  632.  
  633. Gabriel and Steele's "The Evolution of Lisp", which appeared in the
  634. 1993 ACM History of Programming Languages conference, is available by
  635. anonymous ftp from  
  636.    ftp.cs.umbc.edu:/pub/Memoization/Misc/    [130.85.100.53]
  637. as Evolution-of-Lisp.ps.Z. 
  638.  
  639. Brad Miller maintains a Lisp History web page at
  640.    http://www.cs.rochester.edu/u/miller/Lisp-History.html
  641.  
  642. ----------------------------------------------------------------
  643. Subject: [2-14]  How do I find the argument list of a function?
  644.                  How do I get the function name from a function object?
  645.  
  646. There is no standard way to find the argument list of a function,
  647. since implementations are not required to save this information.
  648. However, many implementations do remember argument information, and
  649. usually have a function that returns the lambda list. Here are the
  650. commands from some Lisp implementations:
  651.  
  652.    Lucid:                               arglist
  653.    Allegro:                             excl::arglist
  654.    Symbolics:                           arglist
  655.    LispWorks:                           lw:function-lambda-list
  656.  
  657. CMU Common Lisp, new compiler:
  658.    #+(and :CMU :new-compiler)
  659.    (defun arglist (name)
  660.      (let* ((function (symbol-function name))
  661.             (stype (system:%primitive get-vector-subtype function)))
  662.        (when (eql stype system:%function-entry-subtype)
  663.          (cadr (system:%primitive header-ref function
  664.                                   system:%function-entry-type-slot)))))
  665.  
  666. The draft ANSI standard does include FUNCTION-LAMBDA-EXPRESSION and
  667. FUNCTION-KEYWORDS, which can be used to create an ARGLIST function.
  668.  
  669. If you're interested in the number of required arguments you could use
  670.  
  671.    (defun required-arguments (name)
  672.      (or (position-if #'(lambda (x) (member x lambda-list-keywords))
  673.                       (arglist name))
  674.          (length (arglist name))))
  675.  
  676. To extract the function name from the function object, as in
  677.         (function-name #'car) ==> 'car
  678. use the following vendor-dependent functions:
  679.  
  680.    Symbolics: (si::compiled-function-name <fn>)
  681.     (unless (si:lexical-closure-p <fn>) ...)
  682.    Lucid:     (sys::procedure-ref <fn> SYS:PROCEDURE-SYMBOL)
  683.     (when (sys:procedurep <fn>) ..)
  684.    Allegro:   (xref::object-to-function-name <fn>)
  685.    CMU CL:    (kernel:%function-header-name <fn>)
  686.    AKCL:      (system::compiled-function-name <fn>)
  687.    MCL:       (ccl::function-name <fn>)
  688.    LispWorks: (system::function-name <fn>)
  689.  
  690. If a vendor-dependent function does not exist, the following
  691. (inefficient) code maps over all symbols looking for one whose
  692. function-cell matches the function object.
  693.  
  694. (defun function-name (fobject)
  695.    (do-all-symbols (fsymbol)
  696.       (when (and (fboundp fsymbol)
  697.                  (eq (symbol-function fsymbol) fobject))
  698.         (return fsymbol))))
  699.  
  700. If a vendor supports FUNCTION-LAMBDA-EXPRESSION, the third value is
  701. the name of the function, if available. 
  702.  
  703. ----------------------------------------------------------------
  704. Subject: [2-15] How can I have two Lisp processes communicate via unix sockets?
  705.  
  706. CLX uses Unix sockets to communicate with the X window server. Look at
  707. the following files from the CLX distribution for a good example of
  708. using Unix sockets from Lisp:
  709.         defsystem.lisp          Lucid, AKCL, IBCL, CMU.
  710.         socket.c, sockcl.lisp   AKCL, IBCL
  711.         excldep.lisp            Franz Allegro CL
  712. You will need the "socket.o" files which come with Lucid and Allegro.
  713. To obtain CLX, see the entry for CLX in the answer to question [7-1].
  714.  
  715. See the file sockets.tar.gz in the Lisp Utilities repository
  716. described in the answer to question [6-1].
  717.  
  718. ----------------------------------------------------------------
  719. Subject: [2-16]  How can I create a stream that acts like UNIX's /dev/null
  720.                  (i.e., gobbles any output and immediately signals EOF on
  721.                  input operations)?
  722.  
  723. (defparameter *dev-null*
  724.   #-lispm
  725.   (make-two-way-stream (make-concatenated-stream) (make-broadcast-stream))
  726.   ;; Since Lisp Machines have a built-in /dev/null which handles
  727.   ;; additional, non-standard operations, we'll use that instead.
  728.   #+lispm #'system:null-stream)
  729.  
  730. ----------------------------------------------------------------
  731. Subject: [2-17] Read-time conditionalization of code (#+ #- and *features*)
  732.  
  733. The #+ and #- syntax provides for the read-time conditionalization of
  734. lisp code, depending on the presence or absence of keywords on the
  735. *features* list. The nascent Common Lisp standard does not specify
  736. what keywords an implementation must have on its features list.
  737. Nevertheless, most implementations have features that allow one to
  738. distinguish the implementation from other implementations. This allows
  739. one to write implementation-dependent code that is run only in the
  740. relevant implementations.
  741.  
  742. Here is a list of the features to use to specify a particular Common
  743. Lisp implementation. Unfortunately, not every vendor has a
  744. unique keyword that distinguishes their family of implementations from
  745. those of other vendors, nor major and minor versions of the implementation.
  746.  
  747.    :lucid                       Lucid Common Lisp
  748.    :lcl3.0                      Lucid Common Lisp v3.0 and above
  749.    :lcl4.0                      Lucid Common Lisp v4.0 and above
  750.    ----------------
  751.    (and :allegro :franz-inc)    Franz Allegro Common Lisp
  752.    :excl                        Franz Allegro Common Lisp 
  753.    :aclpc                       Franz Allegro Common Lisp\PC.
  754.    :allegro-v3.0                Franz Allegro Common Lisp v3.0 
  755.    :allegro-v3.1                Franz Allegro Common Lisp v3.1 
  756.    :allegro-v4.0                Franz Allegro Common Lisp v4.0 
  757.    :allegro-v4.1                Franz Allegro Common Lisp v4.1 
  758.    ----------------
  759.    :cmu                         CMU Common Lisp
  760.    (and :cmu :new-compiler)     CMU Common Lisp w/Python compiler
  761.    (and :cmu :python)           CMU Common Lisp w/Python compiler
  762.    :cmu17                       CMU Common Lisp v17 and above
  763.    ----------------
  764.    kcl                          Kyoto Common Lisp
  765.    akcl                         Austin KCL
  766.    :ibcl                        Ibuki Common Lisp 
  767.    ----------------
  768.    :mcl                         Macintosh Common Lisp
  769.    :coral                       Coral Lisp; bought by Apple to become
  770.                 MACL, then MCL
  771.    :ccl                         Coral Common Lisp
  772.     [Note: Harlequin LispWorks also uses :ccl]
  773.    :ccl-1                       Coral Common Lisp v1
  774.    :ccl-1.3                     Coral Common Lisp v1.3 and higher
  775.    :ccl-2                       present in Macintosh Common Lisp 2.0 and higher
  776.    ----------------
  777.    :harlequin-common-lisp       Harlequin Common Lisp
  778.    :harlequin-unix-lisp         Harlequin on Unix platforms
  779.    :harlequin-PC-lisp           Harlequin on PC platforms
  780.    :lispworks                   Harlequin LispWorks development environment
  781.    :lispworks3                  major release of Harlequin LispWorks
  782.    :lispworks3.1                major and minor release of Harlequin LispWorks
  783.    :harlequin                   All Harlequin products. not always present?
  784.    ----------------
  785.    :clisp                       CLISP Common Lisp
  786.    ----------------
  787.    :symbolics                   Symbolics Genera
  788.    :imach                       Symbolics Genera for Ivory architecture
  789.    :cloe-runtime                Symbolics CLOE
  790.    :cloe                        CLOE 3.1
  791.    ----------------
  792.    :procyon                     Procyon Common Lisp
  793.    (and :procyon :macintosh)    Procyon Common Lisp, Macintosh version
  794.    (and :procyon :os2)          Procyon Common Lisp, OS2 version
  795.    ----------------
  796.    :gclisp                      Golden Common Lisp
  797.    ----------------
  798.    (and dec vax common)         DEC VAXlisp
  799.    ----------------
  800.    :explorer                    TI Explorer Lisp Machine  | used
  801.    :TI                          TI Explorer Lisp Machine  | interchangeably
  802.    :elroy                       TI Explorer release 3 and successors
  803.    ----------------
  804.    :Xerox                       Medley (Venue's CL/InterLisp combo) to rel2.01
  805.    :medley                      Medley releases 3.0 and up
  806.       Use  (IL:UNIX-GETPARM "mach") and (IL:UNIX-GETPARM "arch") to
  807.       distinguish platforms under Medley.
  808.    ----------------
  809.    :ecl                         ECoLisp
  810.    ----------------
  811.    :lispm                       Symbolics, TI, and LMI Lisp machines
  812.  
  813.    In the cases where a feature is not a keyword, it is almost always
  814.    in the LISP package.
  815.  
  816. The draft ANSI standard defines some other useful features:
  817.  
  818.   :cltl1                Compatible with the 1st edition of Steele
  819.   :cltl2                Compatible with the 2nd edition of Steele
  820.   :IEEE-Floating-Point  IEEE floating point support
  821.   :X3J13                conforms to some particular draft of the ANSI
  822.                         CL specification 
  823.   :draft-ANSI-CL        conforms to first full public review draft
  824.   :ANSI-CL              conforms to ANSI CL after its adoption
  825.   :common-lisp          language family "Common Lisp"
  826.  
  827. Other features used by some Lisps include:
  828.  
  829.   :clos                 Contains a native CLOS implementation.
  830.   :pcl                  Contains the PCL implementation of CLOS.
  831.   :flavors              Has an implementation of Symbolics Flavors
  832.   :loop                 Contains the :cltl1 version of the Loop macro
  833.   :ansi-loop            Contains the ANSI Loop macro
  834.   :clx or :xlib         Contains CLX
  835.   :clxr4 or :CLX-MIT-R4 Contains CLX for X11R4
  836.   :clxr5 or :CLX-MIT-R5 Contains CLX for X11R5
  837.   :compiler             Contains a compiler  
  838.   :windows              MS Windows version
  839.   :color                Color display
  840.   :monochrome           Monochrome display
  841.   :multiprocessing      Has multiprocessing capabilities.
  842.   :profiler             Has a PC-monitoring based profiler.
  843.  
  844. Platform-specific features, CPU-dependent features, and
  845. operating-system specific features are also important because they can
  846. indicate changes between different implementations of the same lisp,
  847. such as compiled file extensions (e.g., .sbin, .hbin, etc.).
  848. Unfortunately, not every vendor includes such features, and the naming
  849. conventions are inconsistent. Where there are several names for the
  850. same feature, we've put the preferred name first. Hopefully the
  851. vendors will begin to standardize their use of these features.
  852. CPU-dependent features include :sparc (used in CMU CL, Lucid CL,
  853. Harlequin, and Allegro CL), :mips (used in Allegro CL), :r2000 (used
  854. in Allegro CL even on r4000 machines), :mc68000, and :pa (HP's
  855. 9000/800 RISC cpu).  Platform-specific features include :sun (used in
  856. Allegro CL and Lucid), :sun4 (used in CMU CL and Allegro CL), :sgi
  857. (used in Allegro CL), :hp300, :hp400, :hp500, :sun3, :vax, :prime,
  858. :dec, :dec3100, :macintosh (used in Procyon but not MCL), :ibm-pc,
  859. :ibm-rt-pc.  OS-specific features include :unix (used in CMU CL, IBCL,
  860. and Lucid CL), :vms, :sunos (used in CMU CL), :sun-os (used in Lucid),
  861. :sunos4.0 and :sunos4 (used in various Allegro versions independent of
  862. the actual version of SunOS), :mach (used in CMU CL), :hpux, :ultrix,
  863. :os2, and :svr4.
  864.  
  865. Notes:
  866.  
  867.    :allegro alone doesn't suffice to distinguish Franz Allegro Common
  868.    Lisp from Macintosh Allegro Common Lisp (an early version of
  869.    Macintosh Common Lisp). :excl specifies that the EXCL package (a
  870.    set of Allegro extensions to Common Lisp) is present, but this has
  871.    since become synonymous with Franz Allegro Common Lisp.
  872.  
  873.    Thanks to Vincent Keunen for gathering the information in this list.
  874.  
  875. ----------------------------------------------------------------
  876. Subject: [2-18]  What reader macro characters are used in major Lisp systems?
  877.  
  878. The draft ANSI standard for Common Lisp leaves many dispatching macro
  879. characters unassigned. Of these, the following are explicitly reserved
  880. for the user and hence will never be defined by Common Lisp:
  881.    #!, #?, #[, #], #{, and #}. 
  882. All other unassigned macro characters are not reserved for the user,
  883. and hence the user has no guarantee that they won't be used by some
  884. Lisp implementation. 
  885.  
  886. As a result, there is the potential of portability clashes between
  887. systems that use the same macro characters. This question lists the
  888. non-standard macro character usage of major Lisp systems, in an effort
  889. to avoid such conflicts.
  890.  
  891.    #"        AKCL; pathnames
  892.    #$        Macintosh Common Lisp; traps
  893.    #%        Cyc; references to constants in the representation language
  894.    #%        Harlequin LispWorks; ?
  895.    #@        Macintosh Common Lisp; Points notation
  896.    #@         Defsystem    
  897.    #I        Portable Infix Package
  898.    #L        Allegro Common Lisp; logical pathnames
  899.    #M        Series
  900.    #T         Allegro Common Lisp; ?
  901.    #Y        CLISP; ?
  902.    #Z        Series
  903.    #_        Macintosh Common Lisp; traps
  904.    #`        Harlequin LispWorks; ?
  905.  
  906. There is a proposal in the ANSI draft to have COMPILE-FILE and LOAD
  907. bind *READTABLE*, which would allow one to locally redefine syntax
  908. through private readtables. Unfortunately, this doesn't help with the
  909. Infix Package, where one wants to globally extend syntax.
  910.  
  911. ----------------------------------------------------------------
  912. Subject: [2-19] How do I determine if a file is a directory or not? 
  913.                 How do I get the current directory name from within a Lisp 
  914.                 program? Is there any way to create a directory?
  915.  
  916. There is no portable way in Common Lisp of determining whether a file
  917. is a directory or not. Calling DIRECTORY on the pathname will not
  918. always work, since the directory could be empty. For UNIX systems
  919.    (defun DIRECTORY-P (pathname)
  920.       (probe-file (concatenate 'string pathname "/.")))
  921. seems to work fairly reliably. (If "foo" is a directory, then "foo/."
  922. will be a valid filename; if not, it will return NIL.) This won't, of
  923. course, work on the Macintosh, or on other operating systems (e.g.,
  924. MVS, CMS, ITS). On the Macintosh, use DIRECTORYP.
  925.  
  926. Moreover, some operating systems may not support the concept of
  927. directories, or even of a file system. For example, recent work on
  928. object-oriented technology considers files to be collections of
  929. objects. Each type of collection defines a set of methods for reading
  930. and writing the objects "stored" in the collection. 
  931.  
  932.  
  933. There's no standard function for finding the current directory from
  934. within a Lisp program, since not all Lisp environments have the
  935. concept of a current directory. Here are the commands from some Lisp
  936. implementations:
  937.    Lucid:               WORKING-DIRECTORY (which is also SETFable)
  938.                         PWD and CD also work
  939.    Allegro:             CURRENT-DIRECTORY (use excl:chdir to change it)
  940.    CMU CL:              DEFAULT-DIRECTORY
  941.    LispWorks:           LW:*CURRENT-WORKING-DIRECTORY* 
  942.                         (use LW:CHANGE-DIRECTORY to change it)
  943.  
  944. Allegro also uses the variable *default-pathname-defaults* to resolve
  945. relative pathnames, maintaining it as the current working directory.
  946. So evaluating (truename "./") in Allegro (and on certain other
  947. systems) will return a pathname for the current directory. Likewise,
  948. in some VMS systems evaluating (truename "[]") will return a pathname
  949. for the current directory.
  950.  
  951. There is no portable way of creating a new directory from within a
  952. Lisp program. 
  953.  
  954. ----------------------------------------------------------------
  955. Subject: [2-20] What is a "Lisp Machine" (LISPM)?
  956.  
  957. A Lisp machine (or LISPM) is a computer which has been optimized to run lisp
  958. efficiently and provide a good environment for programming in it. The
  959. original Lisp machines were implemented at MIT, with spinoffs as LMI (defunct)
  960. and Symbolics (bankrupt). Xerox also had a series of Lisp machines
  961. (Dandylion, Dandytiger), as did Texas Instruments (TI Explorer). The
  962. TI and Symbolics Lisp machines are currently available as cards that
  963. fit into Macintosh computers (the so-called "Lisp on a chip").
  964.  
  965. Optimizations typical of Lisp machines include:
  966.  
  967.    - Hardware Type Checking. Special type bits let the type be checked
  968.      efficiently at run-time.
  969.  
  970.    - Hardware Garbage Collection. 
  971.  
  972.    - Fast Function Calls. 
  973.  
  974.    - Efficient Representation of Lists.
  975.  
  976.    - System Software and Integrated Programming Environments.
  977.  
  978. For further information, see:
  979.  
  980.    Paul Graham, "Anatomy of a Lisp Machine", AI Expert, December 1988.
  981.  
  982.    Pleszkun and Thazhuthaveetil, "The Architecture of Lisp Machines",
  983.    IEEE Computer, March 1987.
  984.  
  985.    Ditzel, Schuler and Thomas, "A Lisp Machine Profile: Symbolics 3650",
  986.    AI Expert, January 1987.
  987.  
  988.    Peter M. Kogge, "The Architecture of Symbolic Computers",
  989.    McGraw-Hill 1991. ISBN 0-07-035596-7.
  990.  
  991. [Derived from a post by Arthur Pendragon <apendragon@delphi.com>.]
  992.  
  993. ----------------------------------------------------------------
  994. Subject: [2-21] How do I tell if a symbol names a function and not a macro?
  995.  
  996. FBOUNDP tests whether the symbol is globally bound to an operator
  997. (e.g., a function, macro, or special form). SYMBOL-FUNCTION returns
  998. the contents of a symbol's "function slot" if the symbol names a
  999. function. But if the symbol names a macro or special form, it is
  1000. completely unspecified what a call to SYMBOL-FUNCTION will return.
  1001. Instead, use code like the following to test whether a symbol names a
  1002. function: 
  1003.  
  1004.    (defun fbound-to-function-p (symbol)
  1005.      (and (fboundp symbol)
  1006.           (not (macro-function symbol))
  1007.           (not (special-operator-p symbol))))
  1008.  
  1009. ----------------------------------------------------------------
  1010. ;;; *EOF*
  1011.