home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / CLISP / CLISPSRC.TAR / clisp-1995-01-01 / doswatcom / impnotes.txt < prev    next >
Encoding:
Text File  |  1993-12-31  |  49.6 KB  |  1,476 lines

  1.                 Implementation Notes for CLISP
  2.                 ==============================
  3.                 Last modified: 21 December 1993.
  4.  
  5. This implementation is mostly compatible to the standard reference
  6.  
  7.        Guy L. Steele Jr.: Common Lisp - The Language (1st ed.).
  8.        Digital Press 1984, 465 pages.
  9.        ("CLtL1" for short)
  10.  
  11. and to the older parts of
  12.  
  13.        Guy L. Steele Jr.: Common Lisp - The Language (2nd ed.).
  14.        Digital Press 1990, 1032 pages.
  15.        ("CLtL2" for short)
  16.  
  17.  
  18. These notes document the differences of the CLISP implementation of Common
  19. Lisp to the standard CLtL1, and some implementation details.
  20.  
  21. The differences between CLtL1 and CLtL2 are made up of X3J13 votes. CLISP's
  22. position with respect to these votes is listed in cltl2.txt.
  23.  
  24.  
  25.                       CHAPTER 1: Introduction
  26.                       -----------------------
  27.  
  28. No notes.
  29.  
  30.  
  31.                        CHAPTER 2: Data Types
  32.                        ---------------------
  33.  
  34. All the data types are implemented: numbers, characters, symbols, lists,
  35. arrays, hash tables, readtables, packages, pathnames, streams, random
  36. states, structures and functions.
  37.  
  38. 2.1.3.
  39. ------
  40.  
  41. There are four floating point types: short-float, single-float, double-float
  42. and long-float:
  43.                   sign    mantissa   exponent
  44.    short-float    1 bit   16+1 bits   8 bits
  45.    single-float   1 bit   23+1 bits   8 bits   CLISP uses IEEE format
  46.    double-float   1 bit   52+1 bits  11 bits   CLISP uses IEEE format
  47.    long-float     1 bit   >=64 bits  32 bits
  48.  
  49. The single and double float formats are those of the IEEE standard (1981),
  50. except that CLISP does not support features like +0, -0, +inf, -inf, gradual
  51. underflow, NaN, etc. (Common Lisp does not make use of these features.)
  52.  
  53. Long floats have variable mantissa length, which is a multiple of 16 (or 32,
  54. depending on the word size of the processor). The default length used when
  55. long floats are read is given by the place (LONG-FLOAT-DIGITS). It can be
  56. set by (SETF (LONG-FLOAT-DIGITS) nnn), where nnn is a positive integer.
  57.  
  58. 2.1.4.
  59. ------
  60.  
  61. Complex numbers can have a real part and an imaginary part of different
  62. types. For example, (SQRT -9.0) evaluates to the number #C(0 3.0), which has
  63. a real part of exactly 0, not only 0.0 (which would mean "approximately 0").
  64. The type specifier for this is (COMPLEX INTEGER SINGLE-FLOAT), and
  65.  
  66.            (COMPLEX type-of-real-part type-of-imaginary-part)
  67.  
  68. in general.
  69. The type specifier (COMPLEX type) is equivalent to (COMPLEX type type).
  70.  
  71. 2.2.1.
  72. ------
  73.  
  74. The characters are ordered according to the ASCII encoding.
  75.  
  76. More precisely, CLISP uses the IBM PC character set (code page 437):
  77.              $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F
  78.          $00 **                   ** ** ** ** ** ** **  ╢  º
  79.          $10                               ** **            
  80.          $20     !  "  #  $  %  &  '  (  )  *  +  ,  -  .  /
  81.          $30  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ?
  82.          $40  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O
  83.          $50  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _
  84.          $60  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o
  85.          $70  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~  
  86.          $80  ╟  ⁿ  Θ  Γ  Σ  α  σ  τ  Ω  δ  Φ  ∩  ε  ∞  ─  ┼
  87.          $90  ╔  µ  ╞  ⌠  ÷  ≥  √  ∙     ╓  ▄  ó  ú  Ñ      
  88.          $A0  ß  φ  ≤  ·  ±  ╤  ¬  ║  ┐     ¼  ╜  ╝  í  ½  ╗
  89.          $B0                                                
  90.          $C0                                                
  91.          $D0                                                
  92.          $E0     ▀              ╡                           
  93.          $F0     ▒              ≈     ░     ╖        ▓      
  94. Here ** are control characters, not graphic characters. (The characters left
  95. blank here cannot be represented in this character set).
  96.  
  97. The following are standard characters:
  98.   #\Space               $20
  99.   #\Newline             $0A
  100. The following are semi-standard characters:
  101.   #\Backspace           $08
  102.   #\Tab                 $09
  103.   #\Linefeed            $0A
  104.   #\Page                $0C
  105.   #\Return              $0D
  106.   #\Rubout              $08
  107.  
  108. 2.2.2.
  109. ------
  110.  
  111. #\Newline is the delimiter between lines.
  112.  
  113. When writing to a file, #\Newline is converted to CR/LF. (This is the usual
  114. convention on ATARI, DOS and VMS.) For example, #\Return #\Newline is written
  115. as CR/CR/LF.
  116. When reading from a file, CR/LF is converted to #\Newline, and CR not
  117. followed by LF is read as #\Return.
  118.  
  119. 2.2.3.
  120. ------
  121.  
  122. There are the following additional characters with names:
  123.   #\Null                $00
  124.   #\Bell                $07
  125.   #\Escape              $1B
  126.  
  127. 2.2.4.
  128. ------
  129.  
  130. The code of a character is >=0, <256. CHAR-CODE-LIMIT = 256.
  131.  
  132. There are fonts 0 to 15, and CHAR-FONT-LIMIT = 16. But the system itself
  133. uses only font 0.
  134.  
  135. The following bits attributes are implemented: :CONTROL, :META, :SUPER,
  136. :HYPER. Therefore CHAR-BITS-LIMIT = 16.
  137. The system itself uses these bits only to mention special keys and
  138. Control/Alternate/Shift key status on return from
  139. (READ-CHAR *KEYBOARD-INPUT*).
  140.  
  141. 2.5.
  142. ----
  143.  
  144. The maximum rank (number of dimensions) of an array is 65535 on 16-bit
  145. processors, 4294967295 on 32-bit processors.
  146.  
  147. 2.13.
  148. -----
  149.  
  150. All the functions built by FUNCTION, COMPILE and the like are atoms. There
  151. are built-in functions written in C, compiled functions (both of type
  152. COMPILED-FUNCTION) and interpreted functions (of type FUNCTION).
  153. The possible function names (CLtL1 p. 59) are symbols and lambda expressions.
  154.  
  155. 2.14.
  156. -----
  157.  
  158. This is the list of objects whose external representation can not be
  159. meaningfully read in:
  160.   * all structures lacking a keyword constructor.
  161.   * all arrays except strings, if *PRINT-ARRAY* = NIL.
  162.   * #<SYSTEM-FUNCTION name>     built-in function written in C
  163.   * #<SPECIAL-FORM name>        special form handler
  164.   * #<COMPILED-CLOSURE name>    compiled function, if *PRINT-CLOSURE* = NIL
  165.   * #<CLOSURE name ...>         interpreted function
  166.   * #<FRAME-POINTER #x...>      pointer to a stack frame
  167.   * #<DISABLED POINTER>         frame pointer which has become invalid on
  168.                                 exit from the corresponding BLOCK or TAGBODY
  169.   * #<...-STREAM ...>           stream
  170.   * #<PACKAGE name>             package
  171.   * #<HASH-TABLE #x...>         hash table, if *PRINT-ARRAY* = NIL
  172.   * #<READTABLE #x...>          readtable
  173.   * #<UNBOUND>                  "value" of a symbol without value, "value"
  174.                                 of an unsupplied optional or keyword argument
  175.   * #<SPECIAL REFERENCE>        environment marker for variables declared
  176.                                 SPECIAL
  177.   * #<DOT>                      internal READ result for "."
  178.   * #<END OF FILE>              internal READ result, when the end of file
  179.                                 is reached
  180.   * #<READ-LABEL ...>           intermediate READ result for #n#
  181.   * #<ADDRESS #x...>            machine address, should not occur
  182.   * #<SYSTEM-POINTER #x...>     should not occur
  183.  
  184. 2.15.
  185. -----
  186.  
  187. The type NUMBER is the disjoint union of the types REAL and COMPLEX. (CLtL
  188. wording: "exhaustive partition")
  189. The type REAL is the disjoint union of the types RATIONAL and FLOAT.
  190. The type RATIONAL is the disjoint union of the types INTEGER and RATIO.
  191. The type INTEGER is the disjoint union of the types FIXNUM and BIGNUM.
  192. The type FLOAT is the disjoint union of the types SHORT-FLOAT, SINGLE-FLOAT,
  193. DOUBLE-FLOAT and LONG-FLOAT.
  194.  
  195.  
  196.                      CHAPTER 3: Scope and Extent
  197.                      ---------------------------
  198.  
  199. is implemented as described.
  200.  
  201.  
  202.                       CHAPTER 4: Type Specifiers
  203.                       --------------------------
  204.  
  205. 4.4.
  206. ----
  207.  
  208. The CLtL2 type specifier (EQL object) denotes the singleton set {object}.
  209.  
  210. 4.5.
  211. ----
  212.  
  213. The general form of the COMPLEX type specifier is
  214. (COMPLEX type-of-real-part type-of-imaginary-part).
  215. The type specifier (COMPLEX type) is equivalent to (COMPLEX type type).
  216.  
  217. 4.6.
  218. ----
  219.  
  220. The CLtL2 type specifier (REAL low high) denotes the real numbers between low
  221. and high.
  222.  
  223. 4.7.
  224. ----
  225.  
  226. DEFTYPE lambda lists are subject to destructuring (nested lambda lists are
  227. allowed, as in DEFMACRO) and may contain a &WHOLE marker, but no
  228. &ENVIRONMENT marker.
  229.  
  230. 4.9.
  231. ----
  232.  
  233. The possible results of TYPE-OF are:
  234.  CONS
  235.  SYMBOL NULL
  236.  FIXNUM BIGNUM RATIO SHORT-FLOAT SINGLE-FLOAT DOUBLE-FLOAT LONG-FLOAT COMPLEX
  237.  CHARACTER
  238.  (ARRAY element-type dimensions), (SIMPLE-ARRAY element-type dimensions)
  239.  (VECTOR T size), (SIMPLE-VECTOR size)
  240.  (STRING size), (SIMPLE-STRING size)
  241.  (BIT-VECTOR size), (SIMPLE-BIT-VECTOR size)
  242.  FUNCTION COMPILED-FUNCTION
  243.  STREAM PACKAGE HASH-TABLE READTABLE PATHNAME RANDOM-STATE
  244.  BYTE LOAD-TIME-EVAL SYMBOL-MACRO READ-LABEL FRAME-POINTER SYSTEM-INTERNAL
  245.  ADDRESS (should not occur)
  246.  any other symbol (structure types or CLOS classes)
  247.  a class (CLOS classes without proper name)
  248.  
  249.  
  250.                        CHAPTER 5: Program Structure
  251.                        ----------------------------
  252.  
  253. 5.1.3.
  254. ------
  255.  
  256. In addition to the 24 special forms listed on p. 57 (CLtL2: p. 73), the
  257. CLtL2 special forms LOCALLY, SYMBOL-MACROLET, LOAD-TIME-VALUE are implemented,
  258. and the macros
  259. PSETQ, PROG1, PROG2, WHEN, UNLESS, COND, MULTIPLE-VALUE-LIST,
  260. MULTIPLE-VALUE-BIND, MULTIPLE-VALUE-SETQ, AND, OR
  261. are implemented as special forms.
  262.  
  263. Constants may not be bound dynamically or lexically.
  264.  
  265. 5.2.2.
  266. ------
  267.  
  268. LAMBDA-LIST-KEYWORDS =
  269.     (&OPTIONAL &REST &KEY &ALLOW-OTHER-KEYS &AUX &BODY &WHOLE &ENVIRONMENT)
  270.  
  271. LAMBDA-PARAMETERS-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  272. processors.
  273.  
  274. 5.3.
  275. ----
  276.  
  277. DEFUN and DEFMACRO are allowed in non-toplevel positions.
  278. As an example, consider the definition of GENSYM:
  279. (let ((gensym-prefix "G")
  280.       (gensym-count 1))
  281.   (defun gensym (&optional (x nil s))
  282.     (when s
  283.       (cond ((stringp x) (setq gensym-prefix x))
  284.             ((integerp x)
  285.              (if (minusp x)
  286.                (error "~S: index ~S is negative" 'gensym x)
  287.                (setq gensym-count x)
  288.             ))
  289.             (t (error "~S: argument ~S of wrong type" 'gensym x))
  290.     ) )
  291.     (prog1
  292.       (make-symbol
  293.         (concatenate 'string
  294.           gensym-prefix
  295.           (write-to-string gensym-count :base 10 :radix nil)
  296.       ) )
  297.       (incf gensym-count)
  298. ) )
  299.  
  300. 5.3.2.
  301. ------
  302.  
  303. (PROCLAIM '(SPECIAL var)) declarations may not be undone. The same holds
  304. for DEFVAR, DEFPARAMETER and DEFCONSTANT declarations.
  305.  
  306. It is an error if a DEFCONSTANT variable is bound at the moment the
  307. DEFCONSTANT is executed, but DEFCONSTANT does not check this.
  308.  
  309. Constants may not be bound dynamically or lexically.
  310.  
  311.  
  312.                       CHAPTER 6: Predicates
  313.                       ---------------------
  314.  
  315. 6.2.2.
  316. ------
  317.  
  318. REALP returns T is its argument is a real number, NIL otherwise.
  319.  
  320. COMPILED-FUNCTION-P returns T on built-in functions written in C, compiled
  321. functions and special form handlers. Therefore COMPILED-FUNCTION is not a
  322. subtype of FUNCTION.
  323.  
  324. 6.3.
  325. ----
  326.  
  327. EQ compares characters and fixnums as EQL does. No unnecessary copies are
  328. made of characters and numbers. Nevertheless, one should use EQL.
  329.  
  330. (let ((x y)) (eq x x)) always returns T, regardless of y.
  331.  
  332. 6.4.
  333. ----
  334.  
  335. AND and OR are implemented as special forms and, as such, rather efficient.
  336.  
  337.  
  338.                       CHAPTER 7: Control Structure
  339.                       ----------------------------
  340.  
  341. 7.1.1.
  342. ------
  343.  
  344. (FUNCTION symbol) returns the local function definition established by FLET
  345. or LABELS, if it exists, otherwise the global function definition.
  346.  
  347. The CLtL2 place (FDEFINITION function-name) is implemented.
  348.  
  349. (SPECIAL-FORM-P symbol) returns NIL or T. If it returns T, then
  350. (SYMBOL-FUNCTION symbol) returns the (useless) special form handler.
  351.  
  352. 7.1.2.
  353. ------
  354.  
  355. PSETQ is implemented as a special form and, as such, rather efficient.
  356.  
  357. 7.2.
  358. ----
  359.  
  360. (SETF (SYMBOL-FUNCTION symbol) object) requires object to be either a
  361. function, a SYMBOL-FUNCTION return value or a lambda expression. A lambda
  362. expression is thereby immediately converted to a function.
  363.  
  364. SETF also accepts places yielding multiple values.
  365.  
  366. Additional places:
  367.  
  368. * FUNCALL:
  369.   (SETF (FUNCALL #'symbol ...) object) and
  370.   (SETF (FUNCALL 'symbol ...) object)
  371.   are equivalent to (SETF (symbol ...) object).
  372.  
  373. * GET-DISPATCH-MACRO-CHARACTER:
  374.   (SETF (GET-DISPATCH-MACRO-CHARACTER ...) ...)
  375.   performs a SET-DISPATCH-MACRO-CHARACTER.
  376.  
  377. * LONG-FLOAT-DIGITS:
  378.   (SETF (LONG-FLOAT-DIGITS) digits) sets the default mantissa length of long
  379.   floats to digits bits.
  380.  
  381. * VALUES:
  382.   (SETF (VALUES place1 ... placek) form)
  383.   is approximately equivalent to
  384.      (MULTIPLE-VALUE-BIND (dummy1 ... dummyk) form
  385.        (SETF place1 dummy1 ... placek dummyk)
  386.        (VALUES dummy1 ... dummyk)
  387.      )
  388.   Example:
  389.     (SETF (VALUES A B) (VALUES B A)) interchanges the values of A and B.
  390.  
  391. * VALUES-LIST:
  392.   (SETF (VALUES-LIST list) form)  is equivalent to
  393.   (VALUES-LIST (SETF list (MULTIPLE-VALUE-LIST form)))
  394.  
  395. &KEY markers in DEFSETF lambda lists are supported, but the corresponding
  396. keywords must appear literally in the program text.
  397.  
  398. (GET-SETF-METHOD form &optional env) and
  399. (GET-SETF-METHOD-MULTIPLE-VALUE form &optional env)
  400. receives as optional argument the environment necessary for macro expansions.
  401. In DEFINE-SETF-METHOD lambda lists, one can specify &ENVIRONMENT and a
  402. variable, which will be bound to the environment. This environment should be
  403. passed to all calls of GET-SETF-METHOD and GET-SETF-METHOD-MULTIPLE-VALUE.
  404. If this is done, even local macros will be interpreted as places correctly.
  405.  
  406. 7.3.
  407. ----
  408.  
  409. CALL-ARGUMENTS-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  410. processors.
  411.  
  412. 7.4.
  413. ----
  414.  
  415. PROG1 and PROG2 are implemented as special forms and, as such, rather
  416. efficient.
  417.  
  418. 7.5.
  419. ----
  420.  
  421. The CLtL2 special form SYMBOL-MACROLET is implemented.
  422.  
  423. The macro DEFINE-SYMBOL-MACRO establishes symbol macros with global scope
  424. (as opposed to symbol macros defined with SYMBOL-MACROLET, which have local
  425. scope): (DEFINE-SYMBOL-MACRO symbol expansion). Calling BOUNDP, SYMBOL-VALUE
  426. or MAKUNBOUND on symbols defined as symbol macros is not allowed.
  427.  
  428. If using the optional package MACROS3:
  429.   The macros LETF and LETF* are like LET and LET*, resp., except that they
  430.   can bind places, even places with multiple values.
  431.   Example:
  432.   (LETF (((VALUES A B) form)) ...)
  433.     is equivalent to
  434.     (MULTIPLE-VALUE-BIND (A B) form ...)
  435.   (LETF (((FIRST L) 7)) ...)
  436.     is approximately equivalent to
  437.     (LET* ((#:G1 L) (#:G2 (FIRST #:G1)))
  438.       (UNWIND-PROTECT (PROGN (SETF (FIRST #:G1) 7) ...)
  439.                       (SETF (FIRST #:G1) #:G2)
  440.     ) )
  441.  
  442. 7.6.
  443. ----
  444.  
  445. WHEN, UNLESS, COND are implemented as special forms and, as such, rather
  446. efficient.
  447.  
  448. 7.8.4.
  449. ------
  450.  
  451. The function MAPCAP is like MAPCAN, except that it concatenates the
  452. resulting lists with APPEND instead of NCONC:
  453.   (MAPCAP fun x1 ... xn) == (apply #'append (mapcar fun x1 ... xn))
  454. (Actually a bit more efficient that this would be.)
  455.  
  456. The function MAPLAP is like MAPCON, except that it concatenates the
  457. resulting lists with APPEND instead of NCONC:
  458.   (MAPLAP fun x1 ... xn) = (apply #'append (maplist fun x1 ... xn))
  459. (Actually a bit more efficient that this would be.)
  460.  
  461. 7.9.1.
  462. ------
  463.  
  464. MULTIPLE-VALUES-LIMIT = 128
  465.  
  466. MULTIPLE-VALUE-LIST, MULTIPLE-VALUE-BIND, MULTIPLE-VALUE-SETQ are
  467. implemented as special forms and, as such, rather efficient.
  468.  
  469. The macro NTH-VALUE:
  470. (NTH-VALUE n form) returns the (n+1)st value (n>=0) of form.
  471.  
  472.  
  473.                         CHAPTER 8: Macros
  474.                         -----------------
  475.  
  476. No notes.
  477.  
  478.  
  479.                      CHAPTER 9: Declarations
  480.                      -----------------------
  481.  
  482. 9.1.
  483. ----
  484.  
  485. The CLtL2 macro DECLAIM is implemented.
  486.  
  487. 9.2.
  488. ----
  489.  
  490. The declarations (TYPE type var ...), (FTYPE type fun ...),
  491. (FUNCTION name arglist result-type), (OPTIMIZE (quality value) ...)
  492. are ignored by the interpreter and the compiler.
  493.  
  494. The CLtL2 declaration (OPTIMIZE (DEBUG ...)) is legal.
  495.  
  496. Additional declarations:
  497.  
  498. * The declaration (COMPILE) has the effect that the current form is compiled
  499.   prior to execution.
  500.   Examples:
  501.   (LOCALLY (DECLARE (COMPILE)) form)
  502.   executes a compiled version of form.
  503.   (let ((x 0))
  504.     (flet ((inc () (declare (compile)) (incf x))
  505.            (dec () (decf x)))
  506.       (values #'inc #'dec)
  507.   ) )
  508.   returns two functions. The first is compiled and increments x, the second
  509.   is interpreted (slower) and decrements the same x.
  510.  
  511. 9.3.
  512. ----
  513.  
  514. The type assertion (THE value-type form) enforces a type check in
  515. interpreted code. No type check is done in compiled code.
  516.  
  517. If using the optional package MACROS3:
  518. (ETHE value-type form) enforces a type check in both interpreted and
  519. compiled code.
  520.  
  521.  
  522.                          CHAPTER 10: Symbols
  523.                          -------------------
  524.  
  525. No notes.
  526.  
  527.  
  528.                          CHAPTER 11: Packages
  529.                          --------------------
  530.  
  531. 11.6.
  532. -----
  533.  
  534. The package SYSTEM has the nicknames "SYS" and, additionally, "COMPILER".
  535.  
  536. The CLtL2 packages
  537. * COMMON-LISP with nickname "CL" and
  538. * COMMON-LISP-USER with nickname "CL-USER"
  539. are implemented. The package COMMON-LISP exports only those symbols
  540. from the proposed ANSI CL draft that are actually implemented.
  541.  
  542. 11.7.
  543. -----
  544.  
  545. The CLtL2 macro DEFPACKAGE is implemented.
  546.  
  547. 11.8.
  548. -----
  549.  
  550. The function REQUIRE receives as optional argument either a pathname or a
  551. list of pathnames: files to be loaded if the required module is not already
  552. in memory.
  553.  
  554.  
  555.                            CHAPTER 12: Numbers
  556.                            -------------------
  557.  
  558. The single and double float formats are those of the IEEE standard (1981),
  559. except that CLISP does not support features like +0, -0, +inf, -inf, gradual
  560. underflow, NaN, etc. (Common Lisp does not make use of these features.)
  561.  
  562. The default number of mantissa bits in long floats is given by the place
  563. (LONG-FLOAT-DIGITS).
  564. Example: (SETF (LONG-FLOAT-DIGITS) 3322) sets the default precision of long
  565. floats to 1000 decimal digits.
  566.  
  567. 12.1.
  568. -----
  569.  
  570. Complex numbers can have a real part and an imaginary part of different
  571. types. If the imaginary part is EQL to 0, the number is automatically
  572. converted to a real number. (Cf. CLtL1 p. 195)
  573. This has the advantage that  (let ((x (sqrt -9.0))) (* x x))
  574. - instead of evaluting to #C(-9.0 0.0), with x = #C(0.0 3.0) -
  575. evaluates to #C(-9.0 0) = -9.0, with x = #C(0 3.0).
  576.  
  577. Coercions on operations involving different types:
  578. The result of an arithmetic operation whose arguments are of different float
  579. types is rounded to the float format of the shortest (least precise) of the
  580. arguments.
  581.     rational -> long float -> double float -> single float -> short float
  582. (in contrast to CLtL1 p. 195!)
  583. Rationale:
  584.   See it mathematically. Add intervals:
  585.   {1.0 +/- 1e-8} + {1.0 +/- 1e-16} = {2.0 +/- 1e-8}
  586.   So, if we add 1.0s0 and 1.0d0, we should get 2.0s0.
  587. Shortly:
  588.   Do not suggest accuracy of a result by giving it a precision that is
  589.   greater than its accuracy.
  590. Example:
  591.   (- (+ 1.7 pi) pi)  should not return  1.700000726342836417234L0,
  592.   it should return 1.7f0 (or 1.700001f0 if there were rounding errors).
  593. Experience:
  594.   If in a computation using thousands of short floats, a long float (like pi)
  595.   happens to be used, the long precision should not propagate throughout all
  596.   the intermediate values. Otherwise, the long result would look precise,
  597.   but its accuracy is only that of a short float; furthermore much
  598.   computation time would be lost by calculating with long floats when only
  599.   short floats would be needed.
  600.  
  601. When rational numbers are to be converted to floats (due to FLOAT, COERCE,
  602. SQRT or a transcendental function), the result type is given by the variable
  603. *DEFAULT-FLOAT-FORMAT*.
  604.  
  605. 12.4.
  606. -----
  607.  
  608. (LCM), called without arguments, returns 1, which is the neutral element of
  609. composition with LCM.
  610.  
  611. (! n) returns the factorial of n, n a nonnegative integer.
  612.  
  613. (EXQUO x y) returns the quotient x/y of two integers x,y, and checks that it
  614. is an integer. (This is more efficient than /.)
  615.  
  616. (XGCD x1 ... xn) returns the values g, c1, ..., cn, where
  617. g is the greatest common divisor of the integers x1,...,xn,
  618. and c1,...,cn are integer coefficients such that
  619.   g = (GCD x1 ... xn) = (+ (* c1 x1) ... (* cn xn))
  620.  
  621. 12.5.1.
  622. -------
  623.  
  624. (EXPT base exponent) is not very precise if exponent has large absolute
  625. value.
  626.  
  627. (LOG number base) signals an error if base = 1.
  628.  
  629. 12.5.2.
  630. -------
  631.  
  632. The value of PI is a long float with the precision given by
  633. (LONG-FLOAT-DIGITS). When this precision is changed, the value of PI is
  634. automatically recomputed. Therefore PI is a variable, not a constant.
  635.  
  636. 12.6.
  637. -----
  638.  
  639. FLOAT-RADIX always returns 2.
  640.  
  641. (FLOAT-DIGITS number digits) coerces `number' (a real number) to a floating
  642. point number with at least `digits' mantissa digits. The following holds:
  643.    (>= (FLOAT-DIGITS (FLOAT-DIGITS number digits)) digits)
  644.  
  645. 12.7.
  646. -----
  647.  
  648. BOOLE-CLR   =  0
  649. BOOLE-SET   = 15
  650. BOOLE-1     = 10
  651. BOOLE-2     = 12
  652. BOOLE-C1    =  5
  653. BOOLE-C2    =  3
  654. BOOLE-AND   =  8
  655. BOOLE-IOR   = 14
  656. BOOLE-XOR   =  6
  657. BOOLE-EQV   =  9
  658. BOOLE-NAND  =  7
  659. BOOLE-NOR   =  1
  660. BOOLE-ANDC1 =  4
  661. BOOLE-ANDC2 =  2
  662. BOOLE-ORC1  = 13
  663. BOOLE-ORC2  = 11
  664.  
  665. 12.10.
  666. ------
  667.  
  668. MOST-POSITIVE-FIXNUM = 2^24-1 = 16777215
  669. MOST-NEGATIVE-FIXNUM = -2^24 = -16777216
  670.  
  671. Together with PI, the other long float constants MOST-POSITIVE-LONG-FLOAT,
  672. LEAST-POSITIVE-LONG-FLOAT, LEAST-NEGATIVE-LONG-FLOAT,
  673. MOST-NEGATIVE-LONG-FLOAT, LONG-FLOAT-EPSILON, LONG-FLOAT-NEGATIVE-EPSILON
  674. are recomputed whenever (LONG-FLOAT-DIGITS) is changed. They are variables,
  675. not constants.
  676.  
  677.  
  678.                          CHAPTER 13: Characters
  679.                          ----------------------
  680.  
  681. See first above: 2.2.
  682.  
  683. 13.1.
  684. -----
  685.  
  686. CHAR-CODE-LIMIT = 256
  687. CHAR-FONT-LIMIT = 16
  688. CHAR-BITS-LIMIT = 16
  689.  
  690. 13.2.
  691. -----
  692.  
  693. String-chars are those characters with font = 0 and bits = 0.
  694.  
  695. The graphic characters have been described above.
  696.  
  697. The standard characters are #\Newline and those graphic characters with a
  698. code between 32 and 126 (inclusive).
  699.  
  700. The alphabetic characters are these string-chars:
  701.              ABCDEFGHIJKLMNOPQRSTUVWXYZ
  702.              abcdefghijklmnopqrstuvwxyz
  703. and the international alphabetic characters from the character set:
  704.              ╟ⁿΘΓΣαστΩδΦ∩ε∞─┼╔µ╞⌠÷≥√∙ ╓▄▀ßφ≤·±╤¬║A etc.
  705.  
  706. The functions CHAR-EQUAL, CHAR-NOT-EQUAL, CHAR-LESSP, CHAR-GREATERP,
  707. CHAR-NOT-GREATERP, CHAR-NOT-LESSP ignore bits and font attributes of their
  708. arguments.
  709.  
  710. 13.4.
  711. -----
  712.  
  713. The string chars that are not graphic chars and the space character have
  714. names:
  715.   (code-char #x00) = #\Null
  716.   (code-char #x07) = #\Bell
  717.   (code-char #x08) = #\Backspace = #\Rubout
  718.   (code-char #x09) = #\Tab
  719.   (code-char #x0A) = #\Newline = #\Linefeed
  720.   (code-char #x0B) = #\Code11
  721.   (code-char #x0C) = #\Page
  722.   (code-char #x0D) = #\Return
  723.   (code-char #x1A) = #\Code26
  724.   (code-char #x1B) = #\Escape
  725.   (code-char #x20) = #\Space
  726.  
  727. 13.5.
  728. -----
  729.  
  730. CHAR-CONTROL-BIT = 1
  731. CHAR-META-BIT    = 2
  732. CHAR-SUPER-BIT   = 4
  733. CHAR-HYPER-BIT   = 8
  734.  
  735.  
  736.                          CHAPTER 14: Sequences
  737.                          ---------------------
  738.  
  739. 14.1.
  740. -----
  741.  
  742. The result of NREVERSE is always EQ to the argument. NREVERSE on a vector
  743. swaps pairs of elements. NREVERSE on a list swaps the first and the last
  744. element and reverses the list chaining between them.
  745.  
  746. 14.2.
  747. -----
  748.  
  749. For iteration through a sequence, a macro DOSEQ, analogous to DOLIST, may be
  750. used instead of MAP :
  751.   (doseq (var seqform [resultform]) {declaration}* {tag|statement}* )
  752.  
  753. 14.3.
  754. -----
  755.  
  756. REMOVE, REMOVE-IF, REMOVE-IF-NOT, REMOVE-DUPLICATES return their argument
  757. unchanged, if no element has to be removed.
  758.  
  759. DELETE, DELETE-IF, DELETE-IF-NOT, DELETE-DUPLICATES destructively modify
  760. their argument: If the argument is a list, the CDR parts are modified. If
  761. the argument is a vector with fill pointer, the fill pointer is lowered and
  762. the remaining elements are compacted below the new fill pointer.
  763.  
  764. 14.5.
  765. -----
  766.  
  767. SORT and STABLE-SORT have two additional keywords :START and :END :
  768.   (SORT sequence predicate &key :key :start :end)
  769.   (STABLE-SORT sequence predicate &key :key :start :end)
  770.  
  771. SORT and STABLE-SORT are identical. They implement the mergesort algorithm.
  772.  
  773.  
  774.                          CHAPTER 15: Lists
  775.                          -----------------
  776.  
  777. 15.4.
  778. -----
  779.  
  780. SUBLIS and NSUBLIS apply the :KEY argument to the nodes of the cons tree and
  781. not to the keys of the alist.
  782.  
  783.  
  784.                       CHAPTER 16: Hash Tables
  785.                       -----------------------
  786.  
  787. 16.1.
  788. -----
  789.  
  790. MAKE-HASH-TABLE has an additional keyword :INITIAL-CONTENTS :
  791.   (MAKE-HASH-TABLE &key :test :initial-contents :size :rehash-size
  792.                         :rehash-threshold)
  793. The :INITIAL-CONTENTS argument is an alist that is used to initialize the
  794. new hash table.
  795. The :REHASH-THRESHOLD argument is ignored.
  796.  
  797. For iteration through a hash table, a macro DOHASH, analogous to DOLIST, can
  798. be used instead of MAPHASH :
  799.   (dohash (key-var value-var hash-table-form [resultform])
  800.     {declaration}* {tag|statement}*
  801.   )
  802.  
  803.  
  804.                      CHAPTER 17: Arrays
  805.                      ------------------
  806.  
  807. 17.1.
  808. -----
  809.  
  810. ARRAY-RANK-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  811. processors.
  812.  
  813. ARRAY-DIMENSION-LIMIT  = 2^24 = 16777216
  814. ARRAY-TOTAL-SIZE-LIMIT = 2^24 = 16777216
  815.  
  816. 17.6.
  817. -----
  818.  
  819. An array to which another array is displaced should not be shrunk (using
  820. ADJUST-ARRAY) in such a way that the other array points into void space.
  821. This is not checked at the time ADJUST-ARRAY is called!
  822.  
  823.  
  824.                        CHAPTER 18: Strings
  825.                        -------------------
  826.  
  827. 18.2.
  828. -----
  829.  
  830. String comparison is based on the function CHAR<=. Therefore diphtongs do
  831. not obey the usual national rules. Example: "o" < "oe" < "z" < "÷".
  832.  
  833.  
  834.                         CHAPTER 19: Structures
  835.                         ----------------------
  836.  
  837. 19.5.
  838. -----
  839.  
  840. The :PRINT-FUNCTION option should contain a lambda expression
  841.   (lambda (structure stream depth) (declare (ignore depth)) ...)
  842. This lambda expression names a function whose task is to output the external
  843. representation of structure onto the stream. This may be done by outputting
  844. text onto the stream using WRITE-CHAR, WRITE-STRING, WRITE, PRIN1, PRINC,
  845. PRINT, PPRINT, FORMAT and the like. The following rules must be obeyed:
  846. * The value of *PRINT-ESCAPE* must be respected.
  847. * The value of *PRINT-PRETTY* should not and cannot be respected, since the
  848.   pretty-print mechanism is not accessible from outside.
  849. * The value of *PRINT-CIRCLE* need not to be respected. This is managed by
  850.   the system. (But the print-circle mechanism handles only those objects that
  851.   are (direct or indirect) components of structure.)
  852. * The value of *PRINT-LEVEL* is respected by
  853.   WRITE, PRIN1, PRINC, PRINT, PPRINT, FORMAT ~A, FORMAT ~S, FORMAT ~W and
  854.   FORMAT ~D,~B,~O,~X,~R,~F,~E,~G,~$ with not-numerical arguments.
  855.   Therefore the print-level mechanism works automatically if only these
  856.   functions are used for outputting objects and if they are not called on
  857.   objects with nesting level > 1. (The print-level mechanism does not
  858.   recognize how many parentheses you have output. It only counts how many
  859.   times it was called recursively.)
  860. * The value of *PRINT-LENGTH* must be respected, especially if you are
  861.   outputting an arbitrary number of components.
  862. * The value of *PRINT-READABLY* must be respected. Remember that the values
  863.   of *PRINT-ESCAPE*, *PRINT-LEVEL*, *PRINT-LENGTH* don't matter if
  864.   *PRINT-READABLY* is true.
  865.   The value of *PRINT-READABLY* is respected by PRINT-UNREADABLE-OBJECT,
  866.   WRITE, PRIN1, PRINC, PRINT, PPRINT, FORMAT ~A, FORMAT ~S, FORMAT ~W and
  867.   FORMAT ~D,~B,~O,~X,~R,~F,~E,~G,~$ with not-numerical arguments.
  868.   Therefore *PRINT-READABLY* will be respected automatically if only these
  869.   functions are used for outputting objects.
  870. * You need not bother about the values of *PRINT-BASE*, *PRINT-RADIX*,
  871.   *PRINT-CASE*, *PRINT-GENSYM*, *PRINT-ARRAY*, *PRINT-CLOSURE*, *PRINT-RPARS*.
  872.  
  873. The :INHERIT option is exactly like :INCLUDE except that it doesn't create
  874. new accessors for the inherited slots. Use this option to avoid the problems
  875. that occur when using the same :CONC-NAME for the new and the inherited
  876. structure.
  877.  
  878.  
  879.                        CHAPTER 20: The Evaluator
  880.                        -------------------------
  881.  
  882. As in Scheme, the Macro (THE-ENVIRONMENT) returns the current lexical
  883. environment. This works only in interpreted code and is not compilable!
  884.  
  885. (EVAL-ENV form [env]) evaluates a form in a given lexical environment, just
  886. if the form had been part of the program text that environment came from.
  887.  
  888.  
  889.                          CHAPTER 21: Streams
  890.                          -------------------
  891.  
  892. 21.1.
  893. -----
  894.  
  895. *TERMINAL-IO* is not the only stream that communicates directly with the
  896. user: During execution of the body of a (WITH-KEYBOARD . body) form,
  897. *KEYBOARD-INPUT* is the stream that reads the keystrokes from the keyboard.
  898. It returns every keystroke in detail, as character with the following bits:
  899.   HYPER        if a non-standard key. These are:
  900.                  function keys, cursor keypads, numeric keypad.
  901.   CHAR-CODE    the Ascii code for standard keys,
  902.                for non-standard keys:
  903.                  F1 -> #\F1, ..., F10 -> #\F10, F11 -> #\F11, F12 -> #\F12,
  904.                  Insert -> #\Insert, Delete -> #\Delete,
  905.                  Home -> #\Home, End -> #\End, PgUp -> #\PgUp, PgDn -> #\PgDn,
  906.                  Arrow keys -> #\Up, #\Down, #\Left, #\Right.
  907.   SUPER        if pressed together with Shift key(s) and if the keystroke
  908.                would have been an other without Shift.
  909.   CONTROL      if pressed together with the Control key.
  910.   META         if pressed together with the Alternate key.
  911. This keyboard input is not echoed on the screen.
  912. During execution of a (WITH-KEYBOARD . body) form, no input from *TERMINAL-IO*
  913. or any synonymous stream should be requested.
  914.  
  915. 21.2.
  916. -----
  917.  
  918. The macro WITH-OUTPUT-TO-PRINTER
  919.        (with-output-to-printer (var) {declaration}* {form}*)
  920. binds the variable var to an output stream that sends its output to the
  921. printer.
  922.  
  923. 21.3.
  924. -----
  925.  
  926. CLOSE ignores its :ABORT argument.
  927.  
  928.  
  929.                      CHAPTER 22: Input/Output
  930.                      ------------------------
  931.  
  932. 22.1.2.
  933. -------
  934.  
  935. A "reserved token", i.e. a token that has potential number syntax but cannot
  936. be interpreted as a number, is interpreted as symbol when being read. (CLtL1
  937. p. 341)
  938.  
  939. When a token with package markers is read, then (CLtL1 p. 343/344) no
  940. checking is done whether the package part and the symbol-name part do not
  941. have number syntax. (What's the purpose of this check?) So we consider
  942. tokens like USER:: or :1 or LISP::4711 or 21:3 as symbols.
  943.  
  944. 22.1.3.
  945. -------
  946.  
  947. The backquote read macro also works when nested. Example:
  948.  (eval ``(,#'(lambda () ',a) ,#'(lambda () ',b)))
  949.  = (eval `(list #'(lambda () ',a) #'(lambda () ',b)))
  950.  = (eval (list 'list (list 'function (list 'lambda nil (list 'quote a)))
  951.                      (list 'function (list 'lambda nil (list 'quote b)))
  952.    )     )
  953.  
  954. Multiple backquote combinations like ,,@ or ,@,@ are not implemented. Their
  955. use would be confusing anyway.
  956.  
  957. 22.1.4.
  958. -------
  959.  
  960. #\ allows inputting characters of arbitrary code: #\Code231 yields the
  961. character (code-char 231.).
  962.  
  963. Additional read dispatch macros:
  964. * #Y is used to read compiled functions.
  965. * #" is used to read pathnames:
  966.      #"test.lsp" is the value of (pathname "test.lsp")
  967.      As in all strings, backslashes must be written twice here:
  968.      #"A:\\programs\\test.lsp"
  969.  
  970. 22.1.5.
  971. -------
  972.  
  973. Is it impossible to get the read macro function of a dispatch macro
  974. character like #\# using GET-MACRO-CHARACTER.
  975.  
  976. The CLtL2 place READTABLE-CASE is implemented. The possible values of
  977. (READTABLE-CASE readtable) are :UPCASE, :DOWNCASE and :PRESERVE.
  978.  
  979. 22.1.6.
  980. -------
  981.  
  982. In absence of SYS::WRITE-FLOAT, floating point numbers are output in radix 2.
  983.  
  984. If *PRINT-READABLY* is true, *READ-DEFAULT-FLOAT-FORMAT* has no influence on
  985. the way floating point numbers are printed.
  986.  
  987. Pathnames are written according to the syntax #"namestring" if
  988. *PRINT-ESCAPE* /= NIL. If *PRINT-ESCAPE* = NIL, only the namestring is
  989. printed.
  990.  
  991. *PRINT-CASE* controls the output not only of symbols, but also of characters
  992. and some #<...> objects.
  993.  
  994. *PRINT-PRETTY* is initially = NIL.
  995.  
  996. *PRINT-ARRAY* is initially = T.
  997.  
  998. An additional variable *PRINT-CLOSURE* controls whether compiled and
  999. interpreted functions (closures) are output in detailed form. If
  1000. *PRINT-CLOSURE* /= NIL, compiled closures are output in #Y syntax the reader
  1001. understands. *PRINT-CLOSURE* is initially = NIL.
  1002.  
  1003. An additional variable *PRINT-RPARS* controls the output of right (closing)
  1004. parentheses. If *PRINT-RPARS* /= NIL, closing parentheses which don't fit
  1005. onto the same line as the the corresponding opening parenthesis are output
  1006. just below their corresponding opening parenthesis, in the same column.
  1007. *PRINT-RPARS* is initially = T.
  1008.  
  1009. 22.3.1.
  1010. -------
  1011.  
  1012. The functions WRITE and WRITE-TO-STRING have an additional keyword :CLOSURE
  1013. that can be used to bind *PRINT-CLOSURE*.
  1014.  
  1015. The CLtL2 macro PRINT-UNREADABLE-OBJECT is implemented.
  1016.  
  1017. 22.3.3.
  1018. -------
  1019.  
  1020. The FORMAT option ~W is analogous to ~A and ~S, but avoids binding of
  1021. *PRINT-ESCAPE*. (FORMAT stream "~W" object) is equivalent to
  1022. (WRITE object :stream stream).
  1023.  
  1024. FORMAT ~R and FORMAT ~:R can output only integers in the range |n| < 10^66.
  1025. The output is in English, according to the American conventions, and these
  1026. conventions are identical to the British conventions only in the range
  1027. |n| < 10^9.
  1028.  
  1029. FORMAT ~:@C does not output the character itself, only the instruction how
  1030. to type the character.
  1031.  
  1032. For FORMAT ~E and FORMAT ~G, the value of *READ-DEFAULT-FLOAT-FORMAT* doesn't
  1033. matter if *PRINT-READABLY* is true.
  1034.  
  1035. FORMAT ~T can determine the current column of any stream.
  1036.  
  1037.  
  1038.                     CHAPTER 23: File System Interface
  1039.                     ---------------------------------
  1040.  
  1041. 23.1.
  1042. -----
  1043.  
  1044. For most operations, pathnames denoting files and pathnames denoting
  1045. directories can not be used interchangeably.
  1046. This is especially important for the functions DIRECTORY, DIR, CD, MAKE-DIR,
  1047. DELETE-DIR.
  1048.  
  1049. The minimum filename syntax that may be used portably is:
  1050.   "xxx"       for a file with name xxx,
  1051.   "xxx.yy"    for a file with name xxx and type yy,
  1052.   ".yy"       for a pathname with type yy and no name specified.
  1053. Hereby xxx denote 1 to 8 characters, and yy denote 1 to 3 characters, each of
  1054. which being either alphanumerical or the underscore #\_.
  1055. Other properties of pathname syntax vary between operating systems.
  1056.  
  1057. 23.1.1.
  1058. -------
  1059.  
  1060. Pathname components:
  1061. HOST          always NIL
  1062. DEVICE        NIL or :WILD or "A"|...|"Z"
  1063. DIRECTORY     (startpoint . subdirs) where
  1064.                startpoint = :RELATIVE | :ABSOLUTE
  1065.                subdirs = () | (subdir . subdirs)
  1066.                subdir = :CURRENT (means ".") or
  1067.                subdir = :PARENT (means "..") or
  1068.                subdir = :WILD (means "...", all subdirectories) or
  1069.                subdir = (name . type)
  1070.                 name = :WILD or a simple string with 8 characters maximum
  1071.                 type = :WILD or a simple string with 3 characters maximum
  1072. NAME          NIL or :WILD or a simple string with 8 characters maximum
  1073. TYPE          NIL or :WILD or a simple string with 3 characters maximum
  1074. VERSION       always NIL (may also be specified as :WILD or :NEWEST)
  1075.  
  1076. When a pathname is to be fully specified (no wildcards), that means that
  1077. no :WILD is allowed, and NAME = NIL may not be allowed either.
  1078.  
  1079. External notation:        A:\sub1.typ\sub2.typ\name.typ
  1080. using defaults:             \sub1.typ\sub2.typ\name.typ
  1081. or                                             name.typ
  1082. or                        *:\sub1.typ\*.*\name.*
  1083. or similar.
  1084. Instead of '\' one may use '/', as usual for DOS calls.
  1085.  
  1086. 23.1.2.
  1087. -------
  1088.  
  1089. External notation of pathnames (cf. PARSE-NAMESTRING and NAMESTRING),
  1090. of course without spaces, [,],{,}:
  1091.  [ [drivespec]         a letter '*'|'A'|...|'Z'|'a'|...|'z'
  1092.    :
  1093.  ]
  1094.  { name [. type] \ }   each one a subdirectory, '\' may be replaced by '/'
  1095.  [ name [. type] ]     filename with type (extension)
  1096.  
  1097. Name and type may be character sequences of any length (consisting of
  1098. alphanumeric characters and '-', '_'). They are shortened to 8 resp. 3
  1099. characters and converted to upper case. A single '*' is allowed for :WILD.
  1100.  
  1101. The function USER-HOMEDIR-PATHNAME is not implemented.
  1102.  
  1103. 23.2.
  1104. -----
  1105.  
  1106. The file streams returned by OPEN are always buffered.
  1107.  
  1108. 23.3.
  1109. -----
  1110.  
  1111. FILE-AUTHOR always returns NIL.
  1112.  
  1113. FILE-POSITION works on any file stream. When a Newline is output to resp.
  1114. input from a file stream, its file position is increased by 2 since Newline
  1115. is encoded as CR/LF in the file.
  1116.  
  1117. 23.4.
  1118. -----
  1119.  
  1120. LOAD has two additional keywords :ECHO and :COMPILING.
  1121. (LOAD filename &key :verbose :print :echo :if-does-not-exist :compiling)
  1122. :VERBOSE T   causes LOAD to emit a short message that a file is being loaded.
  1123.              The default is *LOAD-VERBOSE*, which is initially = T.
  1124. :PRINT T     causes LOAD to print the value of each form.
  1125.              The default is *LOAD-PRINT*, which is initially = NIL.
  1126. :ECHO T      causes the input from the file to be echoed to *STANDARD-OUTPUT*
  1127.              (normally to the screen). Should there be an error in the file,
  1128.              you can see at one glance where it is.
  1129.              The default is *LOAD-ECHO*, which is initially = NIL.
  1130. :COMPILING T causes each form read to be compiled on the fly. The compiled
  1131.              code is executed at once and - in contrast to COMPILE-FILE -
  1132.              not written to a file.
  1133.  
  1134. The CLtL2 variables *LOAD-PATHNAME* and *LOAD-TRUENAME* are implemented.
  1135.  
  1136. The variable *LOAD-PATHS* contains a list of directories where program files
  1137. are searched - additionally to the specified or current directory - by LOAD,
  1138. REQUIRE, COMPILE-FILE.
  1139.  
  1140. 23.5.
  1141. -----
  1142.  
  1143. (DIRECTORY [pathname [:full] [:circle]]) can run in two modes:
  1144. * If pathname contains no name or type component, a list of all matching
  1145.   directories is produced.
  1146. * Otherwise a list of all matching files is returned. If the :FULL argument
  1147.   is /= NIL, this contains additional information: for each matching file
  1148.   you get a list of at least four elements
  1149.   (file-pathname file-truename file-write-date-as-decoded-time file-length).
  1150.  
  1151. (DIR [pathname]) is like DIRECTORY, but displays the pathnames instead of
  1152. returning them. (DIR) shows the contents of the current directory.
  1153.  
  1154. (CD [pathname]) manages the current device and the current directory.
  1155. (CD pathname) sets it, (CD) returns it.
  1156.  
  1157. (DEFAULT-DIRECTORY) is equivalent to (CD), (SETF (DEFAULT-DIRECTORY) pathname)
  1158. is equivalent to (CD pathname).
  1159.  
  1160. (MAKE-DIR directory-pathname) creates a new subdirectory.
  1161.  
  1162. (DELETE-DIR directory-pathname) removes an (empty) subdirectory.
  1163.  
  1164. (EXECUTE programfile arg1 arg2 ...)  executes an external program. Its name
  1165. is programfile. It is given the strings arg1, arg2, ... as arguments.
  1166.  
  1167. (SHELL [command])  calls the operating system's shell.
  1168. (SHELL) calls the shell for interactive use. (SHELL command) calls the shell
  1169. only for execution of the one given command.
  1170.  
  1171.  
  1172.                         CHAPTER 24: Errors
  1173.                         ------------------
  1174.  
  1175. 24.1.
  1176. -----
  1177.  
  1178. When an error occurred, you are in a break loop. You can evaluate forms as
  1179. usual. The HELP command (or help key if there is one) lists the available
  1180. debugging commands.
  1181.  
  1182.  
  1183.                   CHAPTER 25: Miscellaneous Features
  1184.                   ----------------------------------
  1185.  
  1186. 25.1.
  1187. -----
  1188.  
  1189. The compiler can be called not only by the functions COMPILE, COMPILE-FILE
  1190. and DISASSEMBLE, also by the declaration (COMPILE).
  1191.  
  1192. (COMPILE-FILE input-file [:output-file] [:listing]
  1193.                          [:warnings] [:verbose] [:print])
  1194. compiles a file to bytecode.
  1195.     input-file                should be a pathname/string/symbol.
  1196. The :output-file argument     should be NIL or T or a pathname/string/symbol
  1197.                               or an output-stream. The default is T.
  1198. The :listing argument         should be NIL or T or a pathname/string/symbol
  1199.                               or an output-stream. The default is NIL.
  1200. The :warnings argument        specifies whether warnings should also appear
  1201.                               on the screen.
  1202. The :verbose argument         specifies whether error messages should also
  1203.                               appear on the screen.
  1204. The :print argument           specifies whether an indication which forms are
  1205.                               being compiled should appear on the screen.
  1206. The variables *COMPILE-WARNINGS*, *COMPILE-VERBOSE*, *COMPILE-PRINT* provide
  1207. defaults for the :warnings, :verbose, :print keyword arguments, respectively.
  1208.  
  1209. The CLtL2 variables *COMPILE-FILE-PATHNAME* and *COMPILE-FILE-TRUENAME* are
  1210. implemented.
  1211.  
  1212. The CLtL2 special form LOAD-TIME-VALUE is implemented. (LOAD-TIME-VALUE form)
  1213. is like (QUOTE #,form) except that the former can be generated by macros.
  1214.  
  1215. The CLtL2 function FUNCTION-LAMBDA-EXPRESSION is implemented.
  1216. (FUNCTION-LAMBDA-EXPRESSION function) returns information about the source
  1217. of an interpreted function: lambda-expression, lexical environment, name.
  1218.  
  1219. 25.2.
  1220. -----
  1221.  
  1222. No on-line documentation is available for the system functions (yet).
  1223.  
  1224. 25.3.
  1225. -----
  1226.  
  1227. (TRACE fun ...) makes the functions fun, ... traced. Syntax of fun:
  1228. Either a symbol:
  1229.        symbol
  1230. or a list of a symbol and some keywords and arguments (which must come in
  1231. pairs!):
  1232.        (symbol
  1233.          [:suppress-if form]   ; no trace output as long as form is true
  1234.          [:step-if form]       ; invokes the stepper as soon as form is true
  1235.          [:pre form]           ; evaluates form before calling the function
  1236.          [:post form]          ; evaluates form after return from the function
  1237.          [:pre-break-if form]  ; goes into the break loop before calling the
  1238.                                ; function if form is true
  1239.          [:post-break-if form] ; goes into the break loop after return from
  1240.                                ; the function if form is true
  1241.          [:pre-print form]     ; prints the values of form before calling the
  1242.                                ; function
  1243.          [:post-print form]    ; prints the values of form after return from
  1244.                                ; the function
  1245.          [:print form]         ; prints the values of form both before
  1246.                                ; calling and after return from the function
  1247.        )
  1248. In all these forms you can access
  1249.   the function itself               as *TRACE-FUNCTION*,
  1250.   the arguments to the function     as *TRACE-ARGS*,
  1251.   the function/macro call as form   as *TRACE-FORM*,
  1252. and after return from the function
  1253.   the list of return values from the function call  as *TRACE-VALUES*,
  1254. and you can leave the function call with specified values by using RETURN.
  1255.  
  1256. TRACE and UNTRACE are also applicable to functions (SETF symbol) and to macros,
  1257. but not to locally defined functions and macros.
  1258.  
  1259. The function INSPECT is not implemented.
  1260.  
  1261. The function ROOM can only be called without arguments. It returns two values:
  1262. the number of bytes currently occupied by Lisp objects, and the number of
  1263. bytes that can be allocated before the next regular garbage collection occurs.
  1264.  
  1265. The function ED calls the external editor specified by the variable *EDITOR*
  1266. (see config.lsp).
  1267. If using the optional package EDITOR:
  1268.   ED behaves like this only if the variable *USE-ED* is NIL.
  1269.   Otherwise ED uses an Emacs-like screen editor with multiple windows.
  1270.  
  1271. 25.4.1.
  1272. -------
  1273.  
  1274. The variable *DEFAULT-TIME-ZONE* contains the default time zone used by
  1275. ENCODE-UNIVERSAL-TIME and DECODE-UNIVERSAL-TIME. It is initially set to -1
  1276. (which means 1 hour east of Greenwich, i.e. Mid European Time).
  1277.  
  1278. The timezone in a decoded time must not necessarily be an integer, but (as
  1279. float or rational number) it should be a multiple of 1/4.
  1280.  
  1281. INTERNAL-TIME-UNITS-PER-SECOND = 100.
  1282.  
  1283. 25.4.2.
  1284. -------
  1285.  
  1286. The functions MACHINE-TYPE, MACHINE-VERSION, MACHINE-INSTANCE and
  1287. SHORT-SITE-NAME, LONG-SITE-NAME should be defined by every user in his
  1288. site-specific CONFIG.LSP file.
  1289.  
  1290. The variable *FEATURES* initially contains the symbols
  1291.    CLISP            ; this implementation
  1292.    COMMON-LISP
  1293.    CLTL1
  1294.    INTERPRETER
  1295.    COMPILER
  1296.    CLOS
  1297.    ATARI            ; if hardware = Atari ST/TT and operating system = TOS
  1298.    AMIGA            ; if hardware = Amiga and operating system = Exec/AmigaDOS
  1299.    DOS              ; if hardware = PC (clone)  and operating system = DOS
  1300.    OS/2             ; if hardware = PC (clone)  and operating system = OS/2
  1301.    PC386            ; if hardware = PC (clone) with a 386/486
  1302.    VMS              ; if hardware = VAX         and operating system = VMS
  1303.    UNIX             ; if                            operating system = Unix
  1304.                     ;                               (yes, in this case the
  1305.                     ;                               hardware is irrelevant!)
  1306.    language         ; same as the value of *LANGUAGE*
  1307.  
  1308. The constant *LANGUAGE* is a string containing the language in which the
  1309. system communicates with the user. A symbol of the same name is contained in
  1310. *FEATURES*. Possible values are (yet): ENGLISH, DEUTSCH, FRANCAIS.
  1311.  
  1312.  
  1313.                  CHAPTER 28: Common Lisp Object System
  1314.                  -------------------------------------
  1315.  
  1316. To use CLOS, do (USE-PACKAGE "CLOS").
  1317.  
  1318. The functions
  1319.   SLOT-VALUE, SLOT-BOUNDP, SLOT-MAKUNBOUND, SLOT-EXISTS-P,
  1320.   FIND-CLASS, (SETF FIND-CLASS), CLASS-OF, CALL-NEXT-METHOD, NEXT-METHOD-P,
  1321.   CLASS-NAME, (SETF CLASS-NAME), NO-APPLICABLE-METHOD, NO-NEXT-METHOD,
  1322.   FIND-METHOD, ADD-METHOD, REMOVE-METHOD, COMPUTE-APPLICABLE-METHODS,
  1323.   METHOD-QUALIFIERS, FUNCTION-KEYWORDS, SLOT-MISSING, SLOT-UNBOUND,
  1324.   PRINT-OBJECT, DESCRIBE-OBJECT, MAKE-INSTANCE, INITIALIZE-INSTANCE,
  1325.   REINITIALIZE-INSTANCE, SHARED-INITIALIZE,
  1326. the macros
  1327.   WITH-SLOTS, WITH-ACCESSORS, DEFCLASS, DEFMETHOD, DEFGENERIC,
  1328.   GENERIC-FUNCTION, GENERIC-FLET, GENERIC-LABELS,
  1329. the classes
  1330.   STANDARD-CLASS, STRUCTURE-CLASS, BUILT-IN-CLASS, STANDARD-OBJECT,
  1331.   STANDARD-GENERIC-FUNCTION, STANDARD-METHOD and all predefined classes,
  1332. and the method combination
  1333.   STANDARD
  1334. are implemented.
  1335.  
  1336. Deviations from CLtL2 chapter 28:
  1337.  
  1338. DEFCLASS : It *is* required that the superclasses of a class be defined before
  1339. the DEFCLASS form for the class is evaluated.
  1340.  
  1341. The REAL type is added to the predefined classes listed in table 28-1.
  1342.  
  1343. Only STANDARD method combination is implemented.
  1344.  
  1345. CALL-NEXT-METHOD cannot be called with arguments.
  1346.  
  1347. CALL-NEXT-METHOD and NEXT-METHOD-P are local macros, not local functions.
  1348. Use #'(lambda () (call-next-method)) instead of #'call-next-method if you
  1349. really need it as a function.
  1350.  
  1351. There is a generic function NO-PRIMARY-METHOD (analogous to
  1352. NO-APPLICABLE-METHOD) which is called when a generic function of the class
  1353. STANDARD-GENERIC-FUNCTION is invoked and no primary method on that generic
  1354. function is applicable.
  1355.  
  1356. GENERIC-FLET and GENERIC-LABELS are implemented as macros, not as special
  1357. forms.
  1358.  
  1359. The function ENSURE-GENERIC-FUNCTION is not implemented.
  1360.  
  1361. ADD-METHOD can put methods into other generic functions than the one the method
  1362. came from.
  1363.  
  1364. PRINT-OBJECT and DESCRIBE-OBJECT are only called on objects of type
  1365. STANDARD-OBJECT.
  1366.  
  1367. DESCRIBE-OBJECT should not call DESCRIBE recursively as this would produce
  1368. more information than is likely to be useful to a human reader.
  1369.  
  1370. DOCUMENTATION still has the CLtL1 implementation.
  1371.  
  1372. User-defined method combination is not supported.
  1373. The sections 28.1.7.3., 28.1.7.4., the macros DEFINE-METHOD-COMBINATION,
  1374. CALL-METHOD and the functions INVALID-METHOD-ERROR, METHOD-COMBINATION-ERROR,
  1375. METHOD-QUALIFIERS are not implemented.
  1376.  
  1377. The special form WITH-ADDED-METHODS is not implemented.
  1378.  
  1379. Redefining classes is not supported.
  1380. The sections 28.1.10., 28.1.10.1., 28.1.10.2., 28.1.10.3., 28.1.10.4. and the
  1381. function UPDATE-INSTANCE-FOR-REDEFINED-CLASS are not implemented.
  1382.  
  1383. Changing the class of a given instance is not supported.
  1384. The sections 28.1.11., 28.1.11.1., 28.1.11.2., 28.1.11.3. and the functions
  1385. CHANGE-CLASS, UPDATE-INSTANCE-FOR-DIFFERENT-CLASS, MAKE-INSTANCES-OBSOLETE are
  1386. not implemented.
  1387.  
  1388.  
  1389.                CHAPTER 90: Platform independent Extensions
  1390.                -------------------------------------------
  1391.  
  1392. 90.1. Saving an Image
  1393. ---------------------
  1394.  
  1395. The function (SAVEINITMEM [filename [:quiet] [:init-function]]) saves the
  1396. running CLISP's memory to a file. The filename defaults to "lispinit.mem".
  1397. If the :QUIET argument is not NIL, the startup banner and the good-bye
  1398. message will be suppressed. The :INIT-FUNCTION argument specifies a function
  1399. that will be executed at startup of the saved image.
  1400.  
  1401. 90.2. Quitting Lisp
  1402. -------------------
  1403.  
  1404. The functions (EXIT [errorp]), (QUIT [errorp]) and (BYE [errorp])
  1405. - all synonymous - terminate CLISP. If errorp is not NIL, CLISP aborts with
  1406. error status, i.e. the environment is informed that the CLISP session didn't
  1407. succeed.
  1408.  
  1409.  
  1410.                 CHAPTER 99: Platform specific Extensions
  1411.                 ----------------------------------------
  1412.  
  1413. 99.2. Random Screen Access
  1414. --------------------------
  1415.  
  1416. (SCREEN:MAKE-WINDOW)
  1417.   returns a "window stream". As long as this stream is open, the terminal
  1418.   is in cbreak/noecho mode. *TERMINAL-IO* shouldn't be used for input or
  1419.   output during this time. (Use WITH-KEYBOARD and *KEYBOARD-INPUT* instead.)
  1420.  
  1421. (SCREEN:WITH-WINDOW . body)
  1422.   binds SCREEN:*WINDOW* to a window stream and executes body. The stream is
  1423.   guaranteed to be closed when the body is left. During its execution,
  1424.   *TERMINAL-IO* shouldn't be used, as above.
  1425.  
  1426. (SCREEN:WINDOW-SIZE window-stream)
  1427.   returns the window's size, as two values:
  1428.   height (= Ymax+1) and width (= Xmax+1).
  1429.  
  1430. (SCREEN:WINDOW-CURSOR-POSITION window-stream)
  1431.   returns the position of the cursor in the window, as two values:
  1432.   line (>=0, <=Ymax, 0 means top), column (>=0, <=Xmax, 0 means left margin).
  1433.  
  1434. (SCREEN:SET-WINDOW-CURSOR-POSITION window-stream line column)
  1435.   sets the position of the cursor in the window.
  1436.  
  1437. (SCREEN:CLEAR-WINDOW window-stream)
  1438.   clears the window's contents and puts the cursor in the upper left corner.
  1439.  
  1440. (SCREEN:CLEAR-WINDOW-TO-EOT window-stream)
  1441.   clears the window's contents from the cursor position to the end of window.
  1442.  
  1443. (SCREEN:CLEAR-WINDOW-TO-EOL window-stream)
  1444.   clears the window's contents from the cursor position to the end of line.
  1445.  
  1446. (SCREEN:DELETE-WINDOW-LINE window-stream)
  1447.   removes the cursor's line, moves the lines below it up by one line and
  1448.   clears the window's last line.
  1449.  
  1450. (SCREEN:INSERT-WINDOW-LINE window-stream)
  1451.   inserts a line at the cursor's line, moving the lines below it down by
  1452.   one line.
  1453.  
  1454. (SCREEN:HIGHLIGHT-ON window-stream)
  1455.   switches highlighted output on.
  1456.  
  1457. (SCREEN:HIGHLIGHT-OFF window-stream)
  1458.   switches highlighted output off.
  1459.  
  1460. (SCREEN:WINDOW-CURSOR-ON window-stream)
  1461.   makes the cursor visible, a cursor block in most implementations.
  1462.  
  1463. (SCREEN:WINDOW-CURSOR-OFF window-stream)
  1464.   makes the cursor invisible, in implementations where this is possible.
  1465.  
  1466.  
  1467. Authors:
  1468. --------
  1469.  
  1470.         Bruno Haible                    Michael Stoll
  1471.         Augartenstra▀e 40               Gallierweg 39
  1472.     D - 76137 Karlsruhe             D - 53117 Bonn
  1473.         Germany                         Germany
  1474.  
  1475. Email:  haible@ma2s2.mathematik.uni-karlsruhe.de
  1476.