home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Information / Languages / Lisp / lisp-faq⁄part2 < prev    next >
Encoding:
Internet Message Format  |  1994-12-08  |  48.1 KB  |  [TEXT/R*ch]

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