home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / clisp / doc / impnotes.txt < prev    next >
Text File  |  1977-12-31  |  73KB  |  1,996 lines

  1.                 Implementation Notes for CLISP
  2.                 ==============================
  3.                 Last modified: 30 May 1996.
  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 ISO Latin-1 (ISO 8859-1) character set:
  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              $7F
  107.  
  108. 2.2.2.
  109. ------
  110.  
  111. #\Newline is the delimiter between lines.
  112.  
  113. When reading from a file, CR/LF is converted to #\Newline, and CR not
  114. followed by LF is read as #\Return.
  115.  
  116. 2.2.3.
  117. ------
  118.  
  119. There are the following additional characters with names:
  120.   #\Null                $00
  121.   #\Bell                $07
  122.   #\Escape              $1B
  123.  
  124. 2.2.4.
  125. ------
  126.  
  127. The code of a character is >=0, <256. CHAR-CODE-LIMIT = 256.
  128.  
  129. There are fonts 0 to 15, and CHAR-FONT-LIMIT = 16. But the system itself
  130. uses only font 0.
  131.  
  132. The following bits attributes are implemented: :CONTROL, :META, :SUPER,
  133. :HYPER. Therefore CHAR-BITS-LIMIT = 16.
  134. The system itself uses these bits only to mention special keys and
  135. Control/Alternate/Shift key status on return from
  136. (READ-CHAR *KEYBOARD-INPUT*).
  137.  
  138. 2.5.
  139. ----
  140.  
  141. The maximum rank (number of dimensions) of an array is 65535 on 16-bit
  142. processors, 4294967295 on 32-bit processors.
  143.  
  144. 2.10.
  145. -----
  146.  
  147. The CLtL2 types BROADCAST-STREAM, CONCATENATED-STREAM, ECHO-STREAM,
  148. SYNONYM-STREAM, STRING-STREAM, FILE-STREAM, TWO-WAY-STREAM are implemented.
  149.  
  150. 2.13.
  151. -----
  152.  
  153. All the functions built by FUNCTION, COMPILE and the like are atoms. There
  154. are built-in functions written in C, compiled functions (both of type
  155. COMPILED-FUNCTION) and interpreted functions (of type FUNCTION).
  156. The possible function names (CLtL1 p. 59) are symbols and lambda expressions.
  157.  
  158. 2.14.
  159. -----
  160.  
  161. This is the list of objects whose external representation can not be
  162. meaningfully read in:
  163.   * all structures lacking a keyword constructor.
  164.   * all arrays except strings, if *PRINT-ARRAY* = NIL.
  165.   * #<SYSTEM-FUNCTION name>     built-in function written in C
  166.   * #<ADD-ON-SYSTEM-FUNCTION name>  other function written in C
  167.   * #<SPECIAL-FORM name>        special form handler
  168.   * #<COMPILED-CLOSURE name>    compiled function, if *PRINT-CLOSURE* = NIL
  169.   * #<CLOSURE name ...>         interpreted function
  170.   * #<FRAME-POINTER #x...>      pointer to a stack frame
  171.   * #<DISABLED POINTER>         frame pointer which has become invalid on
  172.                                 exit from the corresponding BLOCK or TAGBODY
  173.   * #<...-STREAM ...>           stream
  174.   * #<PACKAGE name>             package
  175.   * #<HASH-TABLE #x...>         hash table, if *PRINT-ARRAY* = NIL
  176.   * #<READTABLE #x...>          readtable
  177.   * #<SYMBOL-MACRO form>        symbol-macro handler
  178.   * #<FOREIGN-POINTER #x...>    foreign pointer
  179.   * #<UNBOUND>                  "value" of a symbol without value, "value"
  180.                                 of an unsupplied optional or keyword argument
  181.   * #<SPECIAL REFERENCE>        environment marker for variables declared
  182.                                 SPECIAL
  183.   * #<DOT>                      internal READ result for "."
  184.   * #<END OF FILE>              internal READ result, when the end of file
  185.                                 is reached
  186.   * #<READ-LABEL ...>           intermediate READ result for #n#
  187.   * #<ADDRESS #x...>            machine address, should not occur
  188.   * #<SYSTEM-POINTER #x...>     should not occur
  189.  
  190. 2.15.
  191. -----
  192.  
  193. The type NUMBER is the disjoint union of the types REAL and COMPLEX. (CLtL
  194. wording: "exhaustive partition")
  195. The type REAL is the disjoint union of the types RATIONAL and FLOAT.
  196. The type RATIONAL is the disjoint union of the types INTEGER and RATIO.
  197. The type INTEGER is the disjoint union of the types FIXNUM and BIGNUM.
  198. The type FLOAT is the disjoint union of the types SHORT-FLOAT, SINGLE-FLOAT,
  199. DOUBLE-FLOAT and LONG-FLOAT.
  200.  
  201.  
  202.                      CHAPTER 3: Scope and Extent
  203.                      ---------------------------
  204.  
  205. is implemented as described.
  206.  
  207.  
  208.                       CHAPTER 4: Type Specifiers
  209.                       --------------------------
  210.  
  211. 4.4.
  212. ----
  213.  
  214. The CLtL2 type specifier (EQL object) denotes the singleton set {object}.
  215.  
  216. 4.5.
  217. ----
  218.  
  219. The general form of the COMPLEX type specifier is
  220. (COMPLEX type-of-real-part type-of-imaginary-part).
  221. The type specifier (COMPLEX type) is equivalent to (COMPLEX type type).
  222.  
  223. 4.6.
  224. ----
  225.  
  226. The CLtL2 type specifier (REAL low high) denotes the real numbers between low
  227. and high.
  228.  
  229. 4.7.
  230. ----
  231.  
  232. DEFTYPE lambda lists are subject to destructuring (nested lambda lists are
  233. allowed, as in DEFMACRO) and may contain a &WHOLE marker, but no
  234. &ENVIRONMENT marker.
  235.  
  236. 4.9.
  237. ----
  238.  
  239. The possible results of TYPE-OF are:
  240.  CONS
  241.  SYMBOL NULL
  242.  FIXNUM BIGNUM RATIO SHORT-FLOAT SINGLE-FLOAT DOUBLE-FLOAT LONG-FLOAT COMPLEX
  243.  CHARACTER
  244.  (ARRAY element-type dimensions), (SIMPLE-ARRAY element-type dimensions)
  245.  (VECTOR T size), (SIMPLE-VECTOR size)
  246.  (STRING size), (SIMPLE-STRING size)
  247.  (BIT-VECTOR size), (SIMPLE-BIT-VECTOR size)
  248.  FUNCTION COMPILED-FUNCTION
  249.  STREAM FILE-STREAM SYNONYM-STREAM BROADCAST-STREAM CONCATENATED-STREAM
  250.  TWO-WAY-STREAM ECHO-STREAM STRING-STREAM
  251.  PACKAGE HASH-TABLE READTABLE PATHNAME LOGICAL-PATHNAME RANDOM-STATE BYTE
  252.  LOAD-TIME-EVAL SYMBOL-MACRO FOREIGN-VARIABLE FOREIGN-FUNCTION READ-LABEL
  253.  FRAME-POINTER SYSTEM-INTERNAL
  254.  ADDRESS (should not occur)
  255.  any other symbol (structure types or CLOS classes)
  256.  a class (CLOS classes without proper name)
  257.  
  258.  
  259.                        CHAPTER 5: Program Structure
  260.                        ----------------------------
  261.  
  262. 5.1.3.
  263. ------
  264.  
  265. In addition to the 24 special forms listed on p. 57 (CLtL2: p. 73), the
  266. CLtL2 special forms LOCALLY, SYMBOL-MACROLET, LOAD-TIME-VALUE are implemented,
  267. and the macros
  268. PSETQ, PROG1, PROG2, WHEN, UNLESS, COND, MULTIPLE-VALUE-LIST,
  269. MULTIPLE-VALUE-BIND, MULTIPLE-VALUE-SETQ, AND, OR
  270. are implemented as special forms.
  271.  
  272. Constants may not be bound dynamically or lexically.
  273.  
  274. 5.2.2.
  275. ------
  276.  
  277. LAMBDA-LIST-KEYWORDS =
  278.     (&OPTIONAL &REST &KEY &ALLOW-OTHER-KEYS &AUX &BODY &WHOLE &ENVIRONMENT)
  279.  
  280. LAMBDA-PARAMETERS-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  281. processors.
  282.  
  283. 5.3.
  284. ----
  285.  
  286. DEFUN and DEFMACRO are allowed in non-toplevel positions.
  287. As an example, consider the old (CLtL1) definition of GENSYM:
  288. (let ((gensym-prefix "G")
  289.       (gensym-count 1))
  290.   (defun gensym (&optional (x nil s))
  291.     (when s
  292.       (cond ((stringp x) (setq gensym-prefix x))
  293.             ((integerp x)
  294.              (if (minusp x)
  295.                (error "~S: index ~S is negative" 'gensym x)
  296.                (setq gensym-count x)
  297.             ))
  298.             (t (error "~S: argument ~S of wrong type" 'gensym x))
  299.     ) )
  300.     (prog1
  301.       (make-symbol
  302.         (concatenate 'string
  303.           gensym-prefix
  304.           (write-to-string gensym-count :base 10 :radix nil)
  305.       ) )
  306.       (incf gensym-count)
  307. ) )
  308.  
  309. 5.3.2.
  310. ------
  311.  
  312. (PROCLAIM '(SPECIAL var)) declarations may not be undone. The same holds
  313. for DEFVAR, DEFPARAMETER and DEFCONSTANT declarations.
  314.  
  315. It is an error if a DEFCONSTANT variable is bound at the moment the
  316. DEFCONSTANT is executed, but DEFCONSTANT does not check this.
  317.  
  318. Constants may not be bound dynamically or lexically.
  319.  
  320. 5.3.3.
  321. ------
  322.  
  323. EVAL-WHEN also accepts the situations (NOT EVAL) and (NOT COMPILE).
  324.  
  325.  
  326.                       CHAPTER 6: Predicates
  327.                       ---------------------
  328.  
  329. 6.2.2.
  330. ------
  331.  
  332. REALP returns T is its argument is a real number, NIL otherwise.
  333.  
  334. COMPILED-FUNCTION-P returns T on built-in functions written in C, compiled
  335. functions and special form handlers. Therefore COMPILED-FUNCTION is not a
  336. subtype of FUNCTION.
  337.  
  338. 6.3.
  339. ----
  340.  
  341. EQ compares characters and fixnums as EQL does. No unnecessary copies are
  342. made of characters and numbers. Nevertheless, one should use EQL.
  343.  
  344. (let ((x y)) (eq x x)) always returns T, regardless of y.
  345.  
  346. 6.4.
  347. ----
  348.  
  349. AND and OR are implemented as special forms and, as such, rather efficient.
  350.  
  351.  
  352.                       CHAPTER 7: Control Structure
  353.                       ----------------------------
  354.  
  355. 7.1.1.
  356. ------
  357.  
  358. (FUNCTION symbol) returns the local function definition established by FLET
  359. or LABELS, if it exists, otherwise the global function definition.
  360.  
  361. The CLtL2 place (FDEFINITION function-name) is implemented.
  362.  
  363. (SPECIAL-FORM-P symbol) returns NIL or T. If it returns T, then
  364. (SYMBOL-FUNCTION symbol) returns the (useless) special form handler.
  365.  
  366. 7.1.2.
  367. ------
  368.  
  369. PSETQ is implemented as a special form and, as such, rather efficient.
  370.  
  371. 7.2.
  372. ----
  373.  
  374. (SETF (SYMBOL-FUNCTION symbol) object) requires object to be either a
  375. function, a SYMBOL-FUNCTION return value or a lambda expression. A lambda
  376. expression is thereby immediately converted to a function.
  377.  
  378. SETF also accepts places yielding multiple values.
  379.  
  380. Additional places:
  381.  
  382. * FUNCALL:
  383.   (SETF (FUNCALL #'symbol ...) object) and
  384.   (SETF (FUNCALL 'symbol ...) object)
  385.   are equivalent to (SETF (symbol ...) object).
  386.  
  387. * GET-DISPATCH-MACRO-CHARACTER:
  388.   (SETF (GET-DISPATCH-MACRO-CHARACTER ...) ...)
  389.   performs a SET-DISPATCH-MACRO-CHARACTER.
  390.  
  391. * LONG-FLOAT-DIGITS:
  392.   (SETF (LONG-FLOAT-DIGITS) digits) sets the default mantissa length of long
  393.   floats to digits bits.
  394.  
  395. * VALUES:
  396.   (SETF (VALUES place1 ... placek) form)
  397.   is approximately equivalent to
  398.      (MULTIPLE-VALUE-BIND (dummy1 ... dummyk) form
  399.        (SETF place1 dummy1 ... placek dummyk)
  400.        (VALUES dummy1 ... dummyk)
  401.      )
  402.   Example:
  403.     (SETF (VALUES A B) (VALUES B A)) interchanges the values of A and B.
  404.  
  405. * VALUES-LIST:
  406.   (SETF (VALUES-LIST list) form)  is equivalent to
  407.   (VALUES-LIST (SETF list (MULTIPLE-VALUE-LIST form)))
  408.  
  409. &KEY markers in DEFSETF lambda lists are supported, but the corresponding
  410. keywords must appear literally in the program text.
  411.  
  412. (GET-SETF-METHOD form &optional env) and
  413. (GET-SETF-METHOD-MULTIPLE-VALUE form &optional env)
  414. receives as optional argument the environment necessary for macro expansions.
  415. In DEFINE-SETF-METHOD lambda lists, one can specify &ENVIRONMENT and a
  416. variable, which will be bound to the environment. This environment should be
  417. passed to all calls of GET-SETF-METHOD and GET-SETF-METHOD-MULTIPLE-VALUE.
  418. If this is done, even local macros will be interpreted as places correctly.
  419.  
  420. 7.3.
  421. ----
  422.  
  423. CALL-ARGUMENTS-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  424. processors.
  425.  
  426. 7.4.
  427. ----
  428.  
  429. PROG1 and PROG2 are implemented as special forms and, as such, rather
  430. efficient.
  431.  
  432. 7.5.
  433. ----
  434.  
  435. The CLtL2 special form SYMBOL-MACROLET is implemented.
  436.  
  437. The macro DEFINE-SYMBOL-MACRO establishes symbol macros with global scope
  438. (as opposed to symbol macros defined with SYMBOL-MACROLET, which have local
  439. scope): (DEFINE-SYMBOL-MACRO symbol expansion).
  440. The function SYMBOL-MACRO-EXPAND tests for a symbol macro: If symbol is
  441. defined as symbol macro, (SYMBOL-MACRO-EXPAND symbol) returns two values,
  442. T and the expansion, else it returns NIL.
  443. Calling BOUNDP on a symbol defined as symbol macro returns T.
  444. Calling SYMBOL-VALUE on a symbol defined as symbol macro returns the value
  445. of the expansion. Calling SET on a symbol defined as symbol macro calls
  446. SETF on the expansion.
  447. Calling MAKUNBOUND on a symbol defined as symbol macro removes the symbol
  448. macro definition.
  449.  
  450. If using the optional package MACROS3:
  451.   The macros LETF and LETF* are like LET and LET*, resp., except that they
  452.   can bind places, even places with multiple values.
  453.   Example:
  454.   (LETF (((VALUES A B) form)) ...)
  455.     is equivalent to
  456.     (MULTIPLE-VALUE-BIND (A B) form ...)
  457.   (LETF (((FIRST L) 7)) ...)
  458.     is approximately equivalent to
  459.     (LET* ((#:G1 L) (#:G2 (FIRST #:G1)))
  460.       (UNWIND-PROTECT (PROGN (SETF (FIRST #:G1) 7) ...)
  461.                       (SETF (FIRST #:G1) #:G2)
  462.     ) )
  463.  
  464. 7.6.
  465. ----
  466.  
  467. WHEN, UNLESS, COND are implemented as special forms and, as such, rather
  468. efficient.
  469.  
  470. 7.8.4.
  471. ------
  472.  
  473. The function MAPCAP is like MAPCAN, except that it concatenates the
  474. resulting lists with APPEND instead of NCONC:
  475.   (MAPCAP fun x1 ... xn) == (apply #'append (mapcar fun x1 ... xn))
  476. (Actually a bit more efficient that this would be.)
  477.  
  478. The function MAPLAP is like MAPCON, except that it concatenates the
  479. resulting lists with APPEND instead of NCONC:
  480.   (MAPLAP fun x1 ... xn) = (apply #'append (maplist fun x1 ... xn))
  481. (Actually a bit more efficient that this would be.)
  482.  
  483. 7.9.1.
  484. ------
  485.  
  486. MULTIPLE-VALUES-LIMIT = 128
  487.  
  488. MULTIPLE-VALUE-LIST, MULTIPLE-VALUE-BIND, MULTIPLE-VALUE-SETQ are
  489. implemented as special forms and, as such, rather efficient.
  490.  
  491. The macro NTH-VALUE:
  492. (NTH-VALUE n form) returns the (n+1)st value (n>=0) of form.
  493.  
  494.  
  495.                         CHAPTER 8: Macros
  496.                         -----------------
  497.  
  498. 8.3.
  499. ----
  500.  
  501. The CLtL2 macro DESTRUCTURING-BIND is implemented. It does not perform full
  502. error checking.
  503.  
  504.  
  505.                      CHAPTER 9: Declarations
  506.                      -----------------------
  507.  
  508. 9.1.
  509. ----
  510.  
  511. The CLtL2 macro DECLAIM is implemented.
  512.  
  513. 9.2.
  514. ----
  515.  
  516. The declarations (TYPE type var ...), (FTYPE type fun ...),
  517. (FUNCTION name arglist result-type), (OPTIMIZE (quality value) ...)
  518. are ignored by the interpreter and the compiler.
  519.  
  520. The CLtL2 declaration (OPTIMIZE (DEBUG ...)) is legal.
  521.  
  522. Additional declarations:
  523.  
  524. * The dpANS declaration (IGNORABLE var ...) affects the variable binding for
  525.   the variable var. The compiler will not warn about the variable, regardless
  526.   whether it is used or not.
  527.  
  528. * The declaration (COMPILE) has the effect that the current form is compiled
  529.   prior to execution.
  530.   Examples:
  531.   (LOCALLY (DECLARE (COMPILE)) form)
  532.   executes a compiled version of form.
  533.   (let ((x 0))
  534.     (flet ((inc () (declare (compile)) (incf x))
  535.            (dec () (decf x)))
  536.       (values #'inc #'dec)
  537.   ) )
  538.   returns two functions. The first is compiled and increments x, the second
  539.   is interpreted (slower) and decrements the same x.
  540.  
  541. 9.3.
  542. ----
  543.  
  544. The type assertion (THE value-type form) enforces a type check in
  545. interpreted code. No type check is done in compiled code.
  546.  
  547. If using the optional package MACROS3:
  548. (ETHE value-type form) enforces a type check in both interpreted and
  549. compiled code.
  550.  
  551.  
  552.                          CHAPTER 10: Symbols
  553.                          -------------------
  554.  
  555. No notes.
  556.  
  557.  
  558.                          CHAPTER 11: Packages
  559.                          --------------------
  560.  
  561. 11.6.
  562. -----
  563.  
  564. The package SYSTEM has the nicknames "SYS" and, additionally, "COMPILER".
  565.  
  566. The CLtL2 packages
  567. * COMMON-LISP with nickname "CL" and
  568. * COMMON-LISP-USER with nickname "CL-USER"
  569. are implemented. The package COMMON-LISP exports only those symbols
  570. from the proposed ANSI CL draft that are actually implemented.
  571.  
  572. 11.7.
  573. -----
  574.  
  575. The CLtL2 macro DEFPACKAGE is implemented.
  576.  
  577. 11.8.
  578. -----
  579.  
  580. The function REQUIRE receives as optional argument either a pathname or a
  581. list of pathnames: files to be loaded if the required module is not already
  582. in memory.
  583.  
  584.  
  585.                            CHAPTER 12: Numbers
  586.                            -------------------
  587.  
  588. The single and double float formats are those of the IEEE standard (1981),
  589. except that CLISP does not support features like +0, -0, +inf, -inf, gradual
  590. underflow, NaN, etc. (Common Lisp does not make use of these features.)
  591.  
  592. The default number of mantissa bits in long floats is given by the place
  593. (LONG-FLOAT-DIGITS).
  594. Example: (SETF (LONG-FLOAT-DIGITS) 3322) sets the default precision of long
  595. floats to 1000 decimal digits.
  596.  
  597. 12.1.
  598. -----
  599.  
  600. Complex numbers can have a real part and an imaginary part of different
  601. types. If the imaginary part is EQL to 0, the number is automatically
  602. converted to a real number. (Cf. CLtL1 p. 195)
  603. This has the advantage that  (let ((x (sqrt -9.0))) (* x x))
  604. - instead of evaluting to #C(-9.0 0.0), with x = #C(0.0 3.0) -
  605. evaluates to #C(-9.0 0) = -9.0, with x = #C(0 3.0).
  606.  
  607. Coercions on operations involving different types:
  608. The result of an arithmetic operation whose arguments are of different float
  609. types is rounded to the float format of the shortest (least precise) of the
  610. arguments.
  611.     rational -> long float -> double float -> single float -> short float
  612. (in contrast to CLtL1 p. 195!)
  613. Rationale:
  614.   See it mathematically. Add intervals:
  615.   {1.0 +/- 1e-8} + {1.0 +/- 1e-16} = {2.0 +/- 1e-8}
  616.   So, if we add 1.0s0 and 1.0d0, we should get 2.0s0.
  617. Shortly:
  618.   Do not suggest accuracy of a result by giving it a precision that is
  619.   greater than its accuracy.
  620. Example:
  621.   (- (+ 1.7 pi) pi)  should not return  1.700000726342836417234L0,
  622.   it should return 1.7f0 (or 1.700001f0 if there were rounding errors).
  623. Experience:
  624.   If in a computation using thousands of short floats, a long float (like pi)
  625.   happens to be used, the long precision should not propagate throughout all
  626.   the intermediate values. Otherwise, the long result would look precise,
  627.   but its accuracy is only that of a short float; furthermore much
  628.   computation time would be lost by calculating with long floats when only
  629.   short floats would be needed.
  630.  
  631. When rational numbers are to be converted to floats (due to FLOAT, COERCE,
  632. SQRT or a transcendental function), the result type is given by the variable
  633. *DEFAULT-FLOAT-FORMAT*.
  634.  
  635. The macro WITHOUT-FLOATING-POINT-UNDERFLOW:
  636.   (without-floating-point-underflow {form}*)
  637. executes the forms, with errors of type FLOATING-POINT-UNDERFLOW inhibited.
  638. Floating point operations will silently return zero instead of signalling
  639. an error of type FLOATING-POINT-UNDERFLOW.
  640.  
  641. 12.4.
  642. -----
  643.  
  644. (LCM), called without arguments, returns 1, which is the neutral element of
  645. composition with LCM.
  646.  
  647. (! n) returns the factorial of n, n a nonnegative integer.
  648.  
  649. (EXQUO x y) returns the quotient x/y of two integers x,y, and checks that it
  650. is an integer. (This is more efficient than /.)
  651.  
  652. (XGCD x1 ... xn) returns the values g, c1, ..., cn, where
  653. g is the greatest common divisor of the integers x1,...,xn,
  654. and c1,...,cn are integer coefficients such that
  655.   g = (GCD x1 ... xn) = (+ (* c1 x1) ... (* cn xn))
  656.  
  657. 12.5.1.
  658. -------
  659.  
  660. (EXPT base exponent) is not very precise if exponent has large absolute
  661. value.
  662.  
  663. (LOG number base) signals an error if base = 1.
  664.  
  665. 12.5.2.
  666. -------
  667.  
  668. The value of PI is a long float with the precision given by
  669. (LONG-FLOAT-DIGITS). When this precision is changed, the value of PI is
  670. automatically recomputed. Therefore PI is a variable, not a constant.
  671.  
  672. 12.6.
  673. -----
  674.  
  675. FLOAT-RADIX always returns 2.
  676.  
  677. (FLOAT-DIGITS number digits) coerces `number' (a real number) to a floating
  678. point number with at least `digits' mantissa digits. The following holds:
  679.    (>= (FLOAT-DIGITS (FLOAT-DIGITS number digits)) digits)
  680.  
  681. 12.7.
  682. -----
  683.  
  684. BOOLE-CLR   =  0
  685. BOOLE-SET   = 15
  686. BOOLE-1     = 10
  687. BOOLE-2     = 12
  688. BOOLE-C1    =  5
  689. BOOLE-C2    =  3
  690. BOOLE-AND   =  8
  691. BOOLE-IOR   = 14
  692. BOOLE-XOR   =  6
  693. BOOLE-EQV   =  9
  694. BOOLE-NAND  =  7
  695. BOOLE-NOR   =  1
  696. BOOLE-ANDC1 =  4
  697. BOOLE-ANDC2 =  2
  698. BOOLE-ORC1  = 13
  699. BOOLE-ORC2  = 11
  700.  
  701. 12.10.
  702. ------
  703.  
  704. MOST-POSITIVE-FIXNUM = 2^24-1 = 16777215
  705. MOST-NEGATIVE-FIXNUM = -2^24 = -16777216
  706.  
  707. Together with PI, the other long float constants MOST-POSITIVE-LONG-FLOAT,
  708. LEAST-POSITIVE-LONG-FLOAT, LEAST-NEGATIVE-LONG-FLOAT,
  709. MOST-NEGATIVE-LONG-FLOAT, LONG-FLOAT-EPSILON, LONG-FLOAT-NEGATIVE-EPSILON
  710. are recomputed whenever (LONG-FLOAT-DIGITS) is changed. They are variables,
  711. not constants.
  712.  
  713.  
  714.                          CHAPTER 13: Characters
  715.                          ----------------------
  716.  
  717. See first above: 2.2.
  718.  
  719. 13.1.
  720. -----
  721.  
  722. CHAR-CODE-LIMIT = 256
  723. CHAR-FONT-LIMIT = 16
  724. CHAR-BITS-LIMIT = 16
  725.  
  726. 13.2.
  727. -----
  728.  
  729. String-chars are those characters with font = 0 and bits = 0.
  730.  
  731. The graphic characters have been described above.
  732.  
  733. The standard characters are #\Newline and those graphic characters with a
  734. code between 32 and 126 (inclusive).
  735.  
  736. The alphabetic characters are these string-chars:
  737.              ABCDEFGHIJKLMNOPQRSTUVWXYZ
  738.              abcdefghijklmnopqrstuvwxyz
  739. and the international alphabetic characters from the character set:
  740.              ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜßáíóúñѪºãõØøÀÃÕ etc.
  741.  
  742. The functions CHAR-EQUAL, CHAR-NOT-EQUAL, CHAR-LESSP, CHAR-GREATERP,
  743. CHAR-NOT-GREATERP, CHAR-NOT-LESSP ignore bits and font attributes of their
  744. arguments.
  745.  
  746. 13.4.
  747. -----
  748.  
  749. The string chars that are not graphic chars and the space character have
  750. names:
  751.   (code-char #x00) = #\Null
  752.   (code-char #x01) = #\Code1
  753.   (code-char #x02) = #\Code2
  754.   (code-char #x03) = #\Code3
  755.   (code-char #x04) = #\Code4
  756.   (code-char #x05) = #\Code5
  757.   (code-char #x06) = #\Code6
  758.   (code-char #x07) = #\Bell = #\Bel
  759.   (code-char #x08) = #\Backspace = #\Bs
  760.   (code-char #x09) = #\Tab = #\Ht
  761.   (code-char #x0A) = #\Newline = #\Linefeed = #\Lf
  762.   (code-char #x0B) = #\Vt
  763.   (code-char #x0C) = #\Page = #\Ff
  764.   (code-char #x0D) = #\Return = #\Cr
  765.   (code-char #x0E) = #\So
  766.   (code-char #x0F) = #\Si
  767.   (code-char #x10) = #\Code16
  768.   (code-char #x11) = #\Code17
  769.   (code-char #x12) = #\Code18
  770.   (code-char #x13) = #\Code19
  771.   (code-char #x14) = #\Code20
  772.   (code-char #x15) = #\Code21
  773.   (code-char #x16) = #\Code22
  774.   (code-char #x17) = #\Code23
  775.   (code-char #x18) = #\Code24
  776.   (code-char #x19) = #\Code25
  777.   (code-char #x1A) = #\Code26
  778.   (code-char #x1B) = #\Escape = #\Esc
  779.   (code-char #x1C) = #\Code28
  780.   (code-char #x1D) = #\Code29
  781.   (code-char #x1E) = #\Code30
  782.   (code-char #x1F) = #\Code31
  783.   (code-char #x20) = #\Space
  784.   (code-char #x7F) = #\Rubout
  785.   (code-char #x9B) = #\Csi
  786.  
  787. 13.5.
  788. -----
  789.  
  790. CHAR-CONTROL-BIT = 1
  791. CHAR-META-BIT    = 2
  792. CHAR-SUPER-BIT   = 4
  793. CHAR-HYPER-BIT   = 8
  794.  
  795.  
  796.                          CHAPTER 14: Sequences
  797.                          ---------------------
  798.  
  799. The CLtL2 function COMPLEMENT is implemented.
  800.  
  801. 14.1.
  802. -----
  803.  
  804. The result of NREVERSE is always EQ to the argument. NREVERSE on a vector
  805. swaps pairs of elements. NREVERSE on a list swaps the first and the last
  806. element and reverses the list chaining between them.
  807.  
  808. 14.2.
  809. -----
  810.  
  811. For iteration through a sequence, a macro DOSEQ, analogous to DOLIST, may be
  812. used instead of MAP :
  813.   (doseq (var seqform [resultform]) {declaration}* {tag|statement}* )
  814.  
  815. The CLtL2 function MAP-INTO is implemented.
  816.  
  817. 14.3.
  818. -----
  819.  
  820. REMOVE, REMOVE-IF, REMOVE-IF-NOT, REMOVE-DUPLICATES return their argument
  821. unchanged, if no element has to be removed.
  822.  
  823. DELETE, DELETE-IF, DELETE-IF-NOT, DELETE-DUPLICATES destructively modify
  824. their argument: If the argument is a list, the CDR parts are modified. If
  825. the argument is a vector with fill pointer, the fill pointer is lowered and
  826. the remaining elements are compacted below the new fill pointer.
  827.  
  828. 14.5.
  829. -----
  830.  
  831. SORT and STABLE-SORT have two additional keywords :START and :END :
  832.   (SORT sequence predicate &key :key :start :end)
  833.   (STABLE-SORT sequence predicate &key :key :start :end)
  834.  
  835. SORT and STABLE-SORT are identical. They implement the mergesort algorithm.
  836.  
  837.  
  838.                          CHAPTER 15: Lists
  839.                          -----------------
  840.  
  841. 15.4.
  842. -----
  843.  
  844. SUBLIS and NSUBLIS apply the :KEY argument to the nodes of the cons tree and
  845. not to the keys of the alist.
  846.  
  847.  
  848.                       CHAPTER 16: Hash Tables
  849.                       -----------------------
  850.  
  851. 16.1.
  852. -----
  853.  
  854. MAKE-HASH-TABLE has an additional keyword :INITIAL-CONTENTS :
  855.   (MAKE-HASH-TABLE &key :test :initial-contents :size :rehash-size
  856.                         :rehash-threshold)
  857. The :INITIAL-CONTENTS argument is an alist that is used to initialize the
  858. new hash table.
  859. The :REHASH-THRESHOLD argument is ignored.
  860.  
  861. For iteration through a hash table, a macro DOHASH, analogous to DOLIST, can
  862. be used instead of MAPHASH :
  863.   (dohash (key-var value-var hash-table-form [resultform])
  864.     {declaration}* {tag|statement}*
  865.   )
  866.  
  867.  
  868.                      CHAPTER 17: Arrays
  869.                      ------------------
  870.  
  871. 17.1.
  872. -----
  873.  
  874. MAKE-ARRAY can return specialized arrays for the element types
  875. (UNSIGNED-BYTE 2), (UNSIGNED-BYTE 4), (UNSIGNED-BYTE 8), (UNSIGNED-BYTE 16),
  876. (UNSIGNED-BYTE 32) and of course BIT and STRING-CHAR.
  877.  
  878. ARRAY-RANK-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  879. processors.
  880.  
  881. ARRAY-DIMENSION-LIMIT  = 2^24 = 16777216
  882. ARRAY-TOTAL-SIZE-LIMIT = 2^24 = 16777216
  883.  
  884. 17.6.
  885. -----
  886.  
  887. An array to which another array is displaced should not be shrunk (using
  888. ADJUST-ARRAY) in such a way that the other array points into void space.
  889. This is not checked at the time ADJUST-ARRAY is called!
  890.  
  891.  
  892.                        CHAPTER 18: Strings
  893.                        -------------------
  894.  
  895. 18.2.
  896. -----
  897.  
  898. String comparison is based on the function CHAR<=. Therefore diphtongs do
  899. not obey the usual national rules. Example: "o" < "oe" < "z" < "ö".
  900.  
  901.  
  902.                         CHAPTER 19: Structures
  903.                         ----------------------
  904.  
  905. 19.5.
  906. -----
  907.  
  908. The :PRINT-FUNCTION option should contain a lambda expression
  909.   (lambda (structure stream depth) (declare (ignore depth)) ...)
  910. This lambda expression names a function whose task is to output the external
  911. representation of structure onto the stream. This may be done by outputting
  912. text onto the stream using WRITE-CHAR, WRITE-STRING, WRITE, PRIN1, PRINC,
  913. PRINT, PPRINT, FORMAT and the like. The following rules must be obeyed:
  914. * The value of *PRINT-ESCAPE* must be respected.
  915. * The value of *PRINT-PRETTY* should not and cannot be respected, since the
  916.   pretty-print mechanism is not accessible from outside.
  917. * The value of *PRINT-CIRCLE* need not to be respected. This is managed by
  918.   the system. (But the print-circle mechanism handles only those objects that
  919.   are (direct or indirect) components of structure.)
  920. * The value of *PRINT-LEVEL* is respected by
  921.   WRITE, PRIN1, PRINC, PRINT, PPRINT, FORMAT ~A, FORMAT ~S, FORMAT ~W and
  922.   FORMAT ~D,~B,~O,~X,~R,~F,~E,~G,~$ with not-numerical arguments.
  923.   Therefore the print-level mechanism works automatically if only these
  924.   functions are used for outputting objects and if they are not called on
  925.   objects with nesting level > 1. (The print-level mechanism does not
  926.   recognize how many parentheses you have output. It only counts how many
  927.   times it was called recursively.)
  928. * The value of *PRINT-LENGTH* must be respected, especially if you are
  929.   outputting an arbitrary number of components.
  930. * The value of *PRINT-READABLY* must be respected. Remember that the values
  931.   of *PRINT-ESCAPE*, *PRINT-LEVEL*, *PRINT-LENGTH* don't matter if
  932.   *PRINT-READABLY* is true.
  933.   The value of *PRINT-READABLY* is respected by PRINT-UNREADABLE-OBJECT,
  934.   WRITE, PRIN1, PRINC, PRINT, PPRINT, FORMAT ~A, FORMAT ~S, FORMAT ~W and
  935.   FORMAT ~D,~B,~O,~X,~R,~F,~E,~G,~$ with not-numerical arguments.
  936.   Therefore *PRINT-READABLY* will be respected automatically if only these
  937.   functions are used for outputting objects.
  938. * You need not bother about the values of *PRINT-BASE*, *PRINT-RADIX*,
  939.   *PRINT-CASE*, *PRINT-GENSYM*, *PRINT-ARRAY*, *PRINT-CLOSURE*, *PRINT-RPARS*,
  940.   *PRINT-INDENT-LISTS*.
  941.  
  942. The :INHERIT option is exactly like :INCLUDE except that it doesn't create
  943. new accessors for the inherited slots. Use this option to avoid the problems
  944. that occur when using the same :CONC-NAME for the new and the inherited
  945. structure.
  946.  
  947.  
  948.                        CHAPTER 20: The Evaluator
  949.                        -------------------------
  950.  
  951. As in Scheme, the Macro (THE-ENVIRONMENT) returns the current lexical
  952. environment. This works only in interpreted code and is not compilable!
  953.  
  954. (EVAL-ENV form [env]) evaluates a form in a given lexical environment, just
  955. if the form had been part of the program text that environment came from.
  956.  
  957.  
  958.                          CHAPTER 21: Streams
  959.                          -------------------
  960.  
  961. 21.1.
  962. -----
  963.  
  964. *TERMINAL-IO* is not the only stream that communicates directly with the
  965. user: During execution of the body of a (WITH-KEYBOARD . body) form,
  966. *KEYBOARD-INPUT* is the stream that reads the keystrokes from the keyboard.
  967. It returns every keystroke in detail, as character with the following bits:
  968.   HYPER        if a non-standard key. These are:
  969.                  function keys, cursor keypad.
  970.   CHAR-CODE    the Ascii code for standard keys,
  971.                for non-standard keys:
  972.                  F1 -> #\F1, ..., F9 -> #\F9, F10 -> #\F10,
  973.                  Help -> #\Help,
  974.                  Arrow keys -> #\Up, #\Down, #\Left, #\Right.
  975.   SUPER        if pressed together with Shift key(s) and if the keystroke
  976.                would have been an other without Shift.
  977.   CONTROL      if pressed together with the Control key.
  978. This keyboard input is not echoed on the screen.
  979. During execution of a (WITH-KEYBOARD . body) form, no input from *TERMINAL-IO*
  980. or any synonymous stream should be requested.
  981.  
  982. 21.2.
  983. -----
  984.  
  985. The macro WITH-OUTPUT-TO-PRINTER
  986.        (with-output-to-printer (var) {declaration}* {form}*)
  987. binds the variable var to an output stream that sends its output to the
  988. printer.
  989.  
  990. Generic streams are user programmable streams. The programmer interface:
  991.  
  992.   (MAKE-GENERIC-STREAM controller) returns a generic stream.
  993.  
  994.   (GENERIC-STREAM-CONTROLLER stream)
  995.      returns a private object to which generic stream methods dispatch.
  996.      The typical usage is to retrieve the object originally provided by the
  997.      user in MAKE-GENERIC-STREAM.
  998.  
  999.   (GENERIC-STREAM-P stream)
  1000.     determines whether a stream is a generic stream, returning T if it is,
  1001.     NIL otherwise.
  1002.  
  1003. In order to specify the behaviour of a generic stream, the user must define
  1004. CLOS methods on the following CLOS generic functions. The function
  1005. GENERIC-STREAM-XYZ corresponds to the Common Lisp function XYZ. They all
  1006. take a controller and some number of arguments.
  1007.  
  1008.   (GENERIC-STREAM-READ-CHAR    controller)
  1009.   (GENERIC-STREAM-READ-BYTE    controller)
  1010.          These generic functions should return NIL at end of file.
  1011.          Takes one argument, the controller object.
  1012.   (GENERIC-STREAM-LISTEN       controller)
  1013.          Returns -1 for EOF, 0 for character pending, and 1 for none.
  1014.          Takes one argument, the controller object.
  1015.   (GENERIC-STREAM-WRITE-CHAR   controller ch)
  1016.          First argument is the controller object.
  1017.          Second argument is the character to be written.
  1018.   (GENERIC-STREAM-WRITE-BYTE   controller by)
  1019.          First argument is the controller object.
  1020.          Second argument is the integer to be written.
  1021.   (GENERIC-STREAM-WRITE-STRING controller string start len)
  1022.          Called with argument list (controller string start len),
  1023.          this function shall write
  1024.            (subseq (the string string) start (+ start len))
  1025.          First argument is the controller object.
  1026.   (GENERIC-STREAM-CLEAR-INPUT   controller)
  1027.   (GENERIC-STREAM-CLEAR-OUTPUT  controller)
  1028.   (GENERIC-STREAM-FINISH-OUTPUT controller)
  1029.   (GENERIC-STREAM-FORCE-OUTPUT  controller)
  1030.   (GENERIC-STREAM-CLOSE         controller)
  1031.          Takes one argument, the controller object.
  1032.  
  1033. 21.3.
  1034. -----
  1035.  
  1036. The CLtL2 function OPEN-STREAM-P is implemented.
  1037.  
  1038. CLOSE ignores its :ABORT argument.
  1039.  
  1040. The CLtL2 functions BROADCAST-STREAM-STREAMS, CONCATENATED-STREAM-STREAMS,
  1041. ECHO-STREAM-INPUT-STREAM, ECHO-STREAM-OUTPUT-STREAM, SYNONYM-STREAM-SYMBOL,
  1042. TWO-WAY-STREAM-INPUT-STREAM, TWO-WAY-STREAM-OUTPUT-STREAM are implemented.
  1043.  
  1044.  
  1045.                      CHAPTER 22: Input/Output
  1046.                      ------------------------
  1047.  
  1048. 22.1.2.
  1049. -------
  1050.  
  1051. A "reserved token", i.e. a token that has potential number syntax but cannot
  1052. be interpreted as a number, is interpreted as symbol when being read. (CLtL1
  1053. p. 341)
  1054.  
  1055. When a token with package markers is read, then (CLtL1 p. 343/344) no
  1056. checking is done whether the package part and the symbol-name part do not
  1057. have number syntax. (What's the purpose of this check?) So we consider
  1058. tokens like USER:: or :1 or LISP::4711 or 21:3 as symbols.
  1059.  
  1060. 22.1.3.
  1061. -------
  1062.  
  1063. The backquote read macro also works when nested. Example:
  1064.  (eval ``(,#'(lambda () ',a) ,#'(lambda () ',b)))
  1065.  = (eval `(list #'(lambda () ',a) #'(lambda () ',b)))
  1066.  = (eval (list 'list (list 'function (list 'lambda nil (list 'quote a)))
  1067.                      (list 'function (list 'lambda nil (list 'quote b)))
  1068.    )     )
  1069.  
  1070. Multiple backquote combinations like ,,@ or ,@,@ are not implemented. Their
  1071. use would be confusing anyway.
  1072.  
  1073. 22.1.4.
  1074. -------
  1075.  
  1076. #\ allows inputting characters of arbitrary code: #\Code231 yields the
  1077. character (code-char 231.).
  1078.  
  1079. Additional read dispatch macros:
  1080. * #Y is used to read compiled functions.
  1081. * #" is used to read pathnames:
  1082.      #"test.lsp" is the value of (pathname "test.lsp")
  1083.  
  1084. 22.1.5.
  1085. -------
  1086.  
  1087. Is it impossible to get the read macro function of a dispatch macro
  1088. character like #\# using GET-MACRO-CHARACTER.
  1089.  
  1090. The CLtL2 place READTABLE-CASE is implemented. The possible values of
  1091. (READTABLE-CASE readtable) are :UPCASE, :DOWNCASE and :PRESERVE.
  1092.  
  1093. 22.1.6.
  1094. -------
  1095.  
  1096. In absence of SYS::WRITE-FLOAT, floating point numbers are output in radix 2.
  1097.  
  1098. If *PRINT-READABLY* is true, *READ-DEFAULT-FLOAT-FORMAT* has no influence on
  1099. the way floating point numbers are printed.
  1100.  
  1101. Pathnames are written according to the syntax #"namestring" if
  1102. *PRINT-ESCAPE* /= NIL. If *PRINT-ESCAPE* = NIL, only the namestring is
  1103. printed.
  1104.  
  1105. *PRINT-CASE* controls the output not only of symbols, but also of characters
  1106. and some #<...> objects.
  1107.  
  1108. *PRINT-PRETTY* is initially = NIL but set to T in config.lsp. This makes
  1109. unbuffered screen output much faster.
  1110.  
  1111. *PRINT-ARRAY* is initially = T.
  1112.  
  1113. An additional variable *PRINT-CLOSURE* controls whether compiled and
  1114. interpreted functions (closures) are output in detailed form. If
  1115. *PRINT-CLOSURE* /= NIL, compiled closures are output in #Y syntax the reader
  1116. understands. *PRINT-CLOSURE* is initially = NIL.
  1117.  
  1118. An additional variable *PRINT-RPARS* controls the output of right (closing)
  1119. parentheses. If *PRINT-RPARS* /= NIL, closing parentheses which don't fit
  1120. onto the same line as the the corresponding opening parenthesis are output
  1121. just below their corresponding opening parenthesis, in the same column.
  1122. *PRINT-RPARS* is initially = T.
  1123.  
  1124. An additional variable *PRINT-INDENT-LISTS* controls the indentation of lists
  1125. that span more than one line. It specifies by how many characters items
  1126. within the list will be indented relative to the beginning of the list.
  1127. *PRINT-INDENT-LISTS* is initially = 2.
  1128.  
  1129. The CLtL2 macro WITH-STANDARD-IO-SYNTAX is implemented.
  1130.  
  1131. 22.2.1.
  1132. -------
  1133.  
  1134. The function READ-CHAR-SEQUENCE performs multiple READ-CHAR operations:
  1135. (READ-CHAR-SEQUENCE sequence stream [:start] [:end]) fills the
  1136. subsequence of sequence specified by :start and :end with characters
  1137. consecutively read from stream. It returns the index of the first element
  1138. of sequence that was not updated (= end or < end if the stream reached its
  1139. end).
  1140. This function is especially efficient if sequence is a string and stream is
  1141. a file stream with element type STRING-CHAR, a pipe stream or a string input
  1142. stream.
  1143.  
  1144. 22.2.2.
  1145. -------
  1146.  
  1147. The function READ-BYTE-SEQUENCE performs multiple READ-BYTE operations:
  1148. (READ-BYTE-SEQUENCE sequence stream [:start] [:end]) fills the
  1149. subsequence of sequence specified by :start and :end with integers
  1150. consecutively read from stream. It returns the index of the first element
  1151. of sequence that was not updated (= end or < end if the stream reached its
  1152. end).
  1153. This function is especially efficient if sequence is a
  1154. (VECTOR (UNSIGNED-BYTE 8)) and stream is a file stream with element type
  1155. (UNSIGNED-BYTE 8) or a pipe stream.
  1156.  
  1157. 22.3.1.
  1158. -------
  1159.  
  1160. The functions WRITE and WRITE-TO-STRING have an additional keyword :CLOSURE
  1161. that can be used to bind *PRINT-CLOSURE*.
  1162.  
  1163. The CLtL2 macro PRINT-UNREADABLE-OBJECT is implemented.
  1164.  
  1165. The function WRITE-CHAR-SEQUENCE performs multiple WRITE-CHAR operations:
  1166. (WRITE-CHAR-SEQUENCE sequence stream [:start] [:end]) outputs the characters
  1167. of the subsequence of sequence specified by :start and :end to stream.
  1168. It returns sequence.
  1169. This function is especially efficient if sequence is a string and stream is
  1170. a file stream with element type STRING-CHAR or a pipe stream.
  1171.  
  1172. 22.3.2.
  1173. -------
  1174.  
  1175. The function WRITE-BYTE-SEQUENCE performs multiple WRITE-BYTE operations:
  1176. (WRITE-BYTE-SEQUENCE sequence stream [:start] [:end]) outputs the integers
  1177. of the subsequence of sequence specified by :start and :end to stream.
  1178. It returns sequence.
  1179. This function is especially efficient if sequence is a
  1180. (VECTOR (UNSIGNED-BYTE 8)) and stream is a file stream with element type
  1181. (UNSIGNED-BYTE 8) or a pipe stream.
  1182.  
  1183. 22.3.3.
  1184. -------
  1185.  
  1186. The FORMAT option ~W is analogous to ~A and ~S, but avoids binding of
  1187. *PRINT-ESCAPE*. (FORMAT stream "~W" object) is equivalent to
  1188. (WRITE object :stream stream).
  1189.  
  1190. FORMAT ~R and FORMAT ~:R can output only integers in the range |n| < 10^66.
  1191. The output is in English, according to the American conventions, and these
  1192. conventions are identical to the British conventions only in the range
  1193. |n| < 10^9.
  1194.  
  1195. FORMAT ~:@C does not output the character itself, only the instruction how
  1196. to type the character.
  1197.  
  1198. For FORMAT ~E and FORMAT ~G, the value of *READ-DEFAULT-FLOAT-FORMAT* doesn't
  1199. matter if *PRINT-READABLY* is true.
  1200.  
  1201. FORMAT ~T can determine the current column of any stream.
  1202.  
  1203.  
  1204.                     CHAPTER 23: File System Interface
  1205.                     ---------------------------------
  1206.  
  1207. 23.1.
  1208. -----
  1209.  
  1210. For most operations, pathnames denoting files and pathnames denoting
  1211. directories can not be used interchangeably.
  1212. For example, #"FOO/BAR" denotes the file BAR in the directory FOO, while
  1213. #"FOO/BAR/" denotes the subdirectory BAR of the directory FOO.
  1214. This is especially important for the functions DIRECTORY, DIR, CD, MAKE-DIR,
  1215. DELETE-DIR.
  1216.  
  1217. The minimum filename syntax that may be used portably is:
  1218.   "xxx"       for a file with name xxx,
  1219.   "xxx.yy"    for a file with name xxx and type yy,
  1220.   ".yy"       for a pathname with type yy and no name specified.
  1221. Hereby xxx denote 1 to 8 characters, and yy denote 1 to 3 characters, each of
  1222. which being either alphanumerical or the underscore #\_.
  1223. Other properties of pathname syntax vary between operating systems.
  1224.  
  1225. 23.1.1.
  1226. -------
  1227.  
  1228. Pathname components:
  1229. HOST          always NIL
  1230. DEVICE        NIL or a simple string
  1231. DIRECTORY     (startpoint . subdirs) where
  1232.                startpoint = :RELATIVE | :ABSOLUTE
  1233.                subdirs = () | (subdir . subdirs)
  1234.                subdir = :WILD-INFERIORS (means "**" or "...", all subdirectories) or
  1235.                subdir = :PARENT (means "/" instead of "subdir/") or
  1236.                subdir = simple string, may contain wildcard characters ? and *
  1237. NAME          NIL or
  1238.               simple string, may contain wildcard characters ? and *
  1239.               (may also be specified as :WILD)
  1240. TYPE          NIL or
  1241.               simple string, may contain wildcard characters ? and *
  1242.               (may also be specified as :WILD)
  1243. VERSION       always NIL (may also be specified as :WILD or :NEWEST)
  1244.  
  1245. Constraint: startpoint = :RELATIVE only if device = NIL. If the device is
  1246. specified, the pathname must be absolute!
  1247.  
  1248. A filename from AMIGAOS is split into name and type according to the
  1249. following rule:
  1250.   if there is no '.' in the filename, then the name is everything, type = NIL;
  1251.   if there is a '.', then name is the part before and type the part after
  1252.      the last dot.
  1253.  
  1254. Case is ignored in the strings on comparison. No case conversions are
  1255. performed.
  1256.  
  1257. When a pathname is to be fully specified (no wildcards), that means that
  1258. no :WILD, :WILD-INFERIORS is allowed, no wildcard characters are allowed in
  1259. the strings, and NAME = NIL may not be allowed either.
  1260.  
  1261. External notation:      dev:sub1.typ/sub2.typ/name.typ
  1262. using defaults:             sub1.typ/sub2.typ/name.typ
  1263. or                                            name.typ
  1264. or                          sub1.typ/**/sub3.typ/x*.lsp
  1265. or similar.
  1266.  
  1267. Formal specification of the external notation:
  1268.   ch ::= any character except ':','/' and '*','?'
  1269.   name ::= {ch}+
  1270.   device ::= [ <empty> | ':' | name ':' ]
  1271.              ; empty = current device, relative to current directory
  1272.              ; ':'   = current device, absolute (relative to root for disks)
  1273.              ; name ':' = specified device, absolute (relative to root for disks)
  1274.   subdir ::= [ <empty> | name ]                ; empty means parent directory
  1275.   pathname ::= device { subdir '/' }* name
  1276.  
  1277. Examples:
  1278. String       Device    Directory                our pathname
  1279. ------       ------    ---------                --------------
  1280. 'c:foo'      'C',     device->foo               "c" (:ABSOLUTE "foo")
  1281. 'c:foo/'     'C',     device->foo               "c" (:ABSOLUTE "foo")
  1282. 'c:foo/bar'  'C',     device->foo->bar          "c" (:ABSOLUTE "foo" "bar")
  1283. 'c:/foo'     'C',     device->up->foo           "c" (:ABSOLUTE :PARENT "foo")
  1284. 'c:'         'C',     device                    "c" (:ABSOLUTE)
  1285. ':foo'       current, device->root->foo         NIL (:ABSOLUTE "foo")
  1286. 'foo'        current, device->foo               NIL (:RELATIVE "foo")
  1287. '/foo'       current, device->up->foo           NIL (:RELATIVE :PARENT "foo")
  1288. '//foo/bar'  current, device->up->up->foo->bar  NIL (:RELATIVE :PARENT :PARENT "foo" "bar")
  1289. ''           current, device                    NIL (:RELATIVE)
  1290.  
  1291. Appending a '/' to a path string that is non-empty and does not end with ':'
  1292. or '/' does not change its meaning. This '/' must be appended before another
  1293. non-empty component can be appended.
  1294. But appending a '/' to a path string that is empty or ends with ':' or '/'
  1295. means going up to the parent directory!
  1296. We interpret any path string that is empty or ends with ':' or '/' as
  1297. pathname of a directory (with name = NIL and type = NIL).
  1298.  
  1299. The wildcard characters: '*' matches any sequence of characters, '?' matches
  1300. any one character.
  1301.  
  1302. Due to the name/type splitting rule, there are pathnames that can't result
  1303. from PARSE-NAMESTRING. To get a pathname whose type contains a dot or whose
  1304. name contains a dot and whose type is NIL, MAKE-PATHNAME must be used.
  1305. Example: (MAKE-PATHNAME :NAME ".profile").
  1306.  
  1307. 23.1.2.
  1308. -------
  1309.  
  1310. External notation of pathnames (cf. PARSE-NAMESTRING and NAMESTRING),
  1311. of course without spaces, [,],{,}:
  1312. see above.
  1313.  
  1314. NAMESTRING has an optional flag argument: (NAMESTRING pathname T) returns an
  1315. external notation suitable for passing to the operating system or other
  1316. programs.
  1317.  
  1318. The function USER-HOMEDIR-PATHNAME is not implemented.
  1319.  
  1320. 23.1.4.
  1321. -------
  1322.  
  1323. The CLtL2 functions WILD-PATHNAME-P, PATHNAME-MATCH-P and TRANSLATE-PATHNAME
  1324. are implemented.
  1325.  
  1326. PATHNAME-MATCH-P does not interpret missing components as wild.
  1327.  
  1328. TRANSLATE-PATHNAME has two additional keywords:
  1329.   (TRANSLATE-PATHNAME source from-wildname to-wildname &key :all :merge)
  1330. If :ALL is specified and non-NIL, a list of all resulting pathnames,
  1331. corresponding to all matches of (PATHNAME-MATCH-P source from-wildname),
  1332. is returned. If :MERGE is specified and NIL, unspecified pieces of to-pathname
  1333. are not replaced by corresponding pieces of source.
  1334.  
  1335. 23.1.5.
  1336. -------
  1337.  
  1338. The functions LOGICAL-PATHNAME, TRANSLATE-LOGICAL-PATHNAME,
  1339. LOGICAL-PATHNAME-TRANSLATIONS, (SETF LOGICAL-PATHNAME-TRANSLATIONS),
  1340. LOAD-LOGICAL-PATHNAME-TRANSLATIONS, COMPILE-FILE-PATHNAME are implemented.
  1341.  
  1342. RENAME-FILE always returns a non-logical pathname as its first value.
  1343.  
  1344. 23.1.6.
  1345. -------
  1346.  
  1347. (PARSE-NAMESTRING string [host [defaults]]) returns a logical pathname only
  1348. if host is a logical host or host is NIL and defaults is a logical pathname.
  1349. To construct a logical pathname from a string, the function LOGICAL-PATHNAME
  1350. can be used.
  1351.  
  1352. (MERGE-PATHNAMES string [defaults]) returns a logical pathname only if
  1353. defaults is a logical pathname. To construct a logical pathname from a string,
  1354. the function LOGICAL-PATHNAME can be used.
  1355.  
  1356. TRUENAME will not reject pathnames which are directories.
  1357.  
  1358. PARSE-NAMESTRING will interpret a leading `.' in a namestring as part
  1359. of the file name, not the file type.
  1360.  
  1361. 23.2.
  1362. -----
  1363.  
  1364. OPEN cannot handle files of size >= 16 MB.
  1365.  
  1366. The file streams returned by OPEN are buffered for regular files and
  1367. unbuffered for special files.
  1368.  
  1369. 23.3.
  1370. -----
  1371.  
  1372. PROBE-FILE may be used to check whether a directory exists. 
  1373.  
  1374. RENAME-FILE will attempt to overwrite the destination file if it
  1375. already exists.
  1376.  
  1377. FILE-AUTHOR always returns NIL.
  1378.  
  1379. 23.4.
  1380. -----
  1381.  
  1382. LOAD has two additional keywords :ECHO and :COMPILING.
  1383. (LOAD filename &key :verbose :print :echo :if-does-not-exist :compiling)
  1384. :VERBOSE T   causes LOAD to emit a short message that a file is being loaded.
  1385.              The default is *LOAD-VERBOSE*, which is initially = T.
  1386. :PRINT T     causes LOAD to print the value of each form.
  1387.              The default is *LOAD-PRINT*, which is initially = NIL.
  1388. :ECHO T      causes the input from the file to be echoed to *STANDARD-OUTPUT*
  1389.              (normally to the screen). Should there be an error in the file,
  1390.              you can see at one glance where it is.
  1391.              The default is *LOAD-ECHO*, which is initially = NIL.
  1392. :COMPILING T causes each form read to be compiled on the fly. The compiled
  1393.              code is executed at once and - in contrast to COMPILE-FILE -
  1394.              not written to a file.
  1395.  
  1396. The CLtL2 variables *LOAD-PATHNAME* and *LOAD-TRUENAME* are implemented.
  1397.  
  1398. The variable *LOAD-PATHS* contains a list of directories where program files
  1399. are searched - additionally to the specified or current directory - by LOAD,
  1400. REQUIRE, COMPILE-FILE.
  1401.  
  1402. 23.5.
  1403. -----
  1404.  
  1405. (DIRECTORY [pathname [:full] [:circle]]) can run in two modes:
  1406. * If pathname contains no name or type component, a list of all matching
  1407.   directories is produced.
  1408. * Otherwise a list of all matching files is returned. If the :FULL argument
  1409.   is /= NIL, this contains additional information: for each matching file
  1410.   you get a list of at least four elements
  1411.   (file-pathname file-truename file-write-date-as-decoded-time file-length).
  1412.  
  1413. (DIR [pathname]) is like DIRECTORY, but displays the pathnames instead of
  1414. returning them. (DIR) shows the contents of the current directory.
  1415.  
  1416. (CD [pathname]) manages the current directory.
  1417. (CD pathname) sets it, (CD) returns it.
  1418.  
  1419. (DEFAULT-DIRECTORY) is equivalent to (CD), (SETF (DEFAULT-DIRECTORY) pathname)
  1420. is equivalent to (CD pathname).
  1421.  
  1422. (MAKE-DIR directory-pathname) creates a new subdirectory.
  1423.  
  1424. (DELETE-DIR directory-pathname) removes an (empty) subdirectory.
  1425.  
  1426. (EXECUTE command)  executes a given command using the operating system's shell.
  1427.  
  1428. (SHELL [command])  calls the operating system's shell.
  1429. (SHELL) calls the shell for interactive use. (SHELL command) calls the shell
  1430. only for execution of the one given command.
  1431.  
  1432.  
  1433.                         CHAPTER 24: Errors
  1434.                         ------------------
  1435.  
  1436. 24.1.
  1437. -----
  1438.  
  1439. When an error occurred, you are in a break loop. You can evaluate forms as
  1440. usual. The HELP command (or help key if there is one) lists the available
  1441. debugging commands.
  1442.  
  1443.  
  1444.                   CHAPTER 25: Miscellaneous Features
  1445.                   ----------------------------------
  1446.  
  1447. 25.1.
  1448. -----
  1449.  
  1450. The compiler can be called not only by the functions COMPILE, COMPILE-FILE
  1451. and DISASSEMBLE, also by the declaration (COMPILE).
  1452.  
  1453. (COMPILE-FILE input-file [:output-file] [:listing]
  1454.                          [:warnings] [:verbose] [:print])
  1455. compiles a file to bytecode.
  1456.     input-file                should be a pathname/string/symbol.
  1457. The :output-file argument     should be NIL or T or a pathname/string/symbol
  1458.                               or an output-stream. The default is T.
  1459. The :listing argument         should be NIL or T or a pathname/string/symbol
  1460.                               or an output-stream. The default is NIL.
  1461. The :warnings argument        specifies whether warnings should also appear
  1462.                               on the screen.
  1463. The :verbose argument         specifies whether error messages should also
  1464.                               appear on the screen.
  1465. The :print argument           specifies whether an indication which forms are
  1466.                               being compiled should appear on the screen.
  1467. The variables *COMPILE-WARNINGS*, *COMPILE-VERBOSE*, *COMPILE-PRINT* provide
  1468. defaults for the :warnings, :verbose, :print keyword arguments, respectively.
  1469. For each input file (default file type: #".lsp") the following files are
  1470. generated:
  1471.   output file              only if :output-file is not NIL
  1472.                            default file type: #".fas"
  1473.                            contents: can be loaded using the LOAD function.
  1474.   auxiliary output file    only if :output-file is not NIL
  1475.                            default file type: #".lib"
  1476.                            contents: used by COMPILE-FILE when compiling
  1477.                              a REQUIRE form referring to the input file.
  1478.   listing file             only if :listing is not NIL
  1479.                            default file type: #".lis"
  1480.                            contents: disassembly of the output file.
  1481.   C output file            only if :output-file is not NIL
  1482.                            default file type: #".c"
  1483.                            contents: foreign function interface
  1484.                            this file is deleted if it is empty.
  1485.  
  1486. The CLtL2 variables *COMPILE-FILE-PATHNAME* and *COMPILE-FILE-TRUENAME* are
  1487. implemented.
  1488.  
  1489. The CLtL2 special form LOAD-TIME-VALUE is implemented. (LOAD-TIME-VALUE form)
  1490. is like (QUOTE #,form) except that the former can be generated by macros.
  1491.  
  1492. The CLtL2 function FUNCTION-LAMBDA-EXPRESSION is implemented.
  1493. (FUNCTION-LAMBDA-EXPRESSION function) returns information about the source
  1494. of an interpreted function: lambda-expression, lexical environment, name.
  1495.  
  1496. 25.2.
  1497. -----
  1498.  
  1499. No on-line documentation is available for the system functions (yet).
  1500.  
  1501. 25.3.
  1502. -----
  1503.  
  1504. (TRACE fun ...) makes the functions fun, ... traced. Syntax of fun:
  1505. Either a symbol:
  1506.        symbol
  1507. or a list of a symbol and some keywords and arguments (which must come in
  1508. pairs!):
  1509.        (symbol
  1510.          [:suppress-if form]   ; no trace output as long as form is true
  1511.          [:step-if form]       ; invokes the stepper as soon as form is true
  1512.          [:pre form]           ; evaluates form before calling the function
  1513.          [:post form]          ; evaluates form after return from the function
  1514.          [:pre-break-if form]  ; goes into the break loop before calling the
  1515.                                ; function if form is true
  1516.          [:post-break-if form] ; goes into the break loop after return from
  1517.                                ; the function if form is true
  1518.          [:pre-print form]     ; prints the values of form before calling the
  1519.                                ; function
  1520.          [:post-print form]    ; prints the values of form after return from
  1521.                                ; the function
  1522.          [:print form]         ; prints the values of form both before
  1523.                                ; calling and after return from the function
  1524.        )
  1525. In all these forms you can access
  1526.   the function itself               as *TRACE-FUNCTION*,
  1527.   the arguments to the function     as *TRACE-ARGS*,
  1528.   the function/macro call as form   as *TRACE-FORM*,
  1529. and after return from the function
  1530.   the list of return values from the function call  as *TRACE-VALUES*,
  1531. and you can leave the function call with specified values by using RETURN.
  1532.  
  1533. TRACE and UNTRACE are also applicable to functions (SETF symbol) and to macros,
  1534. but not to locally defined functions and macros.
  1535.  
  1536. The function INSPECT is not implemented.
  1537.  
  1538. The function ROOM can only be called without arguments. It returns two values:
  1539. the number of bytes currently occupied by Lisp objects, and the number of
  1540. bytes that can be allocated before the next regular garbage collection occurs.
  1541.  
  1542. The function ED calls the external editor specified by the variable *EDITOR*
  1543. (see config.lsp).
  1544. If using the optional package EDITOR:
  1545.   ED behaves like this only if the variable *USE-ED* is NIL.
  1546.   Otherwise ED uses a screen editor with multiple windows.
  1547.  
  1548. The function UNCOMPILE does the converse of COMPILE: (UNCOMPILE function-name)
  1549. reverts an interpreted function that has been entered or loaded in the same
  1550. session and then compiled back to its interpreted form.
  1551.  
  1552. 25.4.1.
  1553. -------
  1554.  
  1555. The variable *DEFAULT-TIME-ZONE* contains the default time zone used by
  1556. ENCODE-UNIVERSAL-TIME and DECODE-UNIVERSAL-TIME. It is initially set to -1
  1557. (which means 1 hour east of Greenwich, i.e. Mid European Time).
  1558.  
  1559. The timezone in a decoded time must not necessarily be an integer, but (as
  1560. float or rational number) it should be a multiple of 1/4.
  1561.  
  1562. INTERNAL-TIME-UNITS-PER-SECOND = 50.
  1563.  
  1564. 25.4.2.
  1565. -------
  1566.  
  1567. The functions MACHINE-TYPE, MACHINE-VERSION, MACHINE-INSTANCE and
  1568. SHORT-SITE-NAME, LONG-SITE-NAME should be defined by every user in his
  1569. site-specific CONFIG.LSP file.
  1570.  
  1571. The variable *FEATURES* initially contains the symbols
  1572.    CLISP            ; this implementation
  1573.    COMMON-LISP
  1574.    CLTL1
  1575.    INTERPRETER
  1576.    COMPILER
  1577.    LOGICAL-PATHNAMES
  1578.    LOOP
  1579.    CLOS
  1580.    AMIGA            ; if hardware = Amiga and operating system = Exec/AmigaDOS
  1581.    DOS              ; if hardware = PC (clone) and operating system = DOS
  1582.    OS/2             ; if hardware = PC (clone) and operating system = OS/2
  1583.    PC386            ; if hardware = PC (clone) with a 386/486
  1584.    UNIX             ; if                            operating system = Unix
  1585.                     ;                               (yes, in this case the
  1586.                     ;                               hardware is irrelevant!)
  1587.  
  1588.  
  1589.                            CHAPTER 26: Loop
  1590.                            ----------------
  1591.  
  1592. The CLtL2 macros LOOP and LOOP-FINISH are implemented.
  1593.  
  1594.  
  1595.                        CHAPTER 27: Pretty Printing
  1596.                        ---------------------------
  1597.  
  1598. The CLtL2 macro FORMATTER is implemented.
  1599.  
  1600.  
  1601.                  CHAPTER 28: Common Lisp Object System
  1602.                  -------------------------------------
  1603.  
  1604. To use CLOS, do (USE-PACKAGE "CLOS").
  1605.  
  1606. The functions
  1607.   SLOT-VALUE, SLOT-BOUNDP, SLOT-MAKUNBOUND, SLOT-EXISTS-P,
  1608.   FIND-CLASS, (SETF FIND-CLASS), CLASS-OF, CALL-NEXT-METHOD, NEXT-METHOD-P,
  1609.   CLASS-NAME, (SETF CLASS-NAME), NO-APPLICABLE-METHOD, NO-NEXT-METHOD,
  1610.   FIND-METHOD, ADD-METHOD, REMOVE-METHOD, COMPUTE-APPLICABLE-METHODS,
  1611.   METHOD-QUALIFIERS, FUNCTION-KEYWORDS, SLOT-MISSING, SLOT-UNBOUND,
  1612.   PRINT-OBJECT, DESCRIBE-OBJECT, MAKE-INSTANCE, INITIALIZE-INSTANCE,
  1613.   REINITIALIZE-INSTANCE, SHARED-INITIALIZE,
  1614. the macros
  1615.   WITH-SLOTS, WITH-ACCESSORS, DEFCLASS, DEFMETHOD, DEFGENERIC,
  1616.   GENERIC-FUNCTION, GENERIC-FLET, GENERIC-LABELS,
  1617. the classes
  1618.   STANDARD-CLASS, STRUCTURE-CLASS, BUILT-IN-CLASS, STANDARD-OBJECT,
  1619.   STANDARD-GENERIC-FUNCTION, STANDARD-METHOD and all predefined classes,
  1620. and the method combination
  1621.   STANDARD
  1622. are implemented.
  1623.  
  1624. Deviations from CLtL2 chapter 28:
  1625.  
  1626. DEFCLASS : It *is* required that the superclasses of a class be defined before
  1627. the DEFCLASS form for the class is evaluated.
  1628.  
  1629. The REAL type is added to the predefined classes listed in table 28-1.
  1630.  
  1631. Only STANDARD method combination is implemented.
  1632.  
  1633. When CALL-NEXT-METHOD is called with arguments, the rule that the ordered
  1634. set of applicable methods must be the same as for the original arguments
  1635. is not enforced by the implementation.
  1636.  
  1637. CALL-NEXT-METHOD and NEXT-METHOD-P are local macros, not local functions.
  1638. Use #'(lambda () (call-next-method)) instead of #'call-next-method if you
  1639. really need it as a function.
  1640.  
  1641. There is a generic function NO-PRIMARY-METHOD (analogous to
  1642. NO-APPLICABLE-METHOD) which is called when a generic function of the class
  1643. STANDARD-GENERIC-FUNCTION is invoked and no primary method on that generic
  1644. function is applicable.
  1645.  
  1646. GENERIC-FLET and GENERIC-LABELS are implemented as macros, not as special
  1647. forms.
  1648.  
  1649. The function ENSURE-GENERIC-FUNCTION is not implemented.
  1650.  
  1651. ADD-METHOD can put methods into other generic functions than the one the method
  1652. came from.
  1653.  
  1654. PRINT-OBJECT and DESCRIBE-OBJECT are only called on objects of type
  1655. STANDARD-OBJECT.
  1656.  
  1657. DESCRIBE-OBJECT should not call DESCRIBE recursively as this would produce
  1658. more information than is likely to be useful to a human reader.
  1659.  
  1660. DOCUMENTATION still has the CLtL1 implementation.
  1661.  
  1662. User-defined method combination is not supported.
  1663. The sections 28.1.7.3., 28.1.7.4., the macros DEFINE-METHOD-COMBINATION,
  1664. CALL-METHOD and the functions INVALID-METHOD-ERROR, METHOD-COMBINATION-ERROR,
  1665. METHOD-QUALIFIERS are not implemented.
  1666.  
  1667. The special form WITH-ADDED-METHODS is not implemented.
  1668.  
  1669. Redefining classes is not supported.
  1670. The sections 28.1.10., 28.1.10.1., 28.1.10.2., 28.1.10.3., 28.1.10.4. and the
  1671. function UPDATE-INSTANCE-FOR-REDEFINED-CLASS are not implemented.
  1672.  
  1673. Changing the class of a given instance is not supported.
  1674. The sections 28.1.11., 28.1.11.1., 28.1.11.2., 28.1.11.3. and the functions
  1675. CHANGE-CLASS, UPDATE-INSTANCE-FOR-DIFFERENT-CLASS, MAKE-INSTANCES-OBSOLETE are
  1676. not implemented.
  1677.  
  1678.  
  1679.                         CHAPTER 29: Conditions
  1680.                         ----------------------
  1681.  
  1682. 29.4.1.
  1683. -------
  1684.  
  1685. The default condition type for conditions created by SIGNAL is
  1686. SIMPLE-CONDITION, not SIMPLE-ERROR.
  1687.  
  1688. 29.4.4.
  1689. -------
  1690.  
  1691. The macro (MUFFLE-CERRORS {form}*) executes the forms. When a continuable
  1692. error occurs, no message is printed. Instead, the CONTINUE restart is invoked.
  1693.  
  1694. The macro (APPEASE-CERRORS {form}*) executes the forms. When a continuable
  1695. error occurs, the error is printed as a warning and the CONTINUE restart is
  1696. invoked.
  1697.  
  1698. The macro (EXIT-ON-ERROR {form}*) executes the forms. When a non-continuable
  1699. error occurs, the error is printed and CLISP terminates with error status.
  1700.  
  1701. 29.4.7.
  1702. -------
  1703.  
  1704. In RESTART-CASE clauses the argument list can also be specified after the
  1705. keyword/value pairs instead of before them. The syntax therefore is
  1706.   (RESTART-CASE form {restart-clause}*)
  1707. with
  1708.   restart-clause ::=   (restart-name arglist {keyword value}* {form}*)
  1709.                      | (restart-name {keyword value}* arglist {form}*)
  1710.  
  1711. The macro WITH-RESTARTS is like RESTART-CASE, except that the forms are
  1712. specified after the restart clauses instead of before them, and the
  1713. restarts created are not implicitly associated to any condition.
  1714.   (WITH-RESTARTS ({restart-clause}*) {form}*)
  1715. is therefore equivalent to (RESTART-CASE (PROGN {form}*) {restart-clause}*).
  1716.  
  1717. 29.4.8.
  1718. -------
  1719.  
  1720. COMPUTE-RESTARTS and FIND-RESTART behave as specified in dpANS: If the
  1721. optional condition argument is not NIL, only restarts associated with that
  1722. condition and restarts associated to no condition at all are considered.
  1723. Therefore the effect of associating a restart to a condition is not to
  1724. activate it, but to hide it from other conditions. This makes the syntax
  1725. dependent implicit association performed by RESTART-CASE nearly obsolete.
  1726.  
  1727. 29.4.9.
  1728. -------
  1729.  
  1730. The default condition type for conditions created by WARN is SIMPLE-WARNING,
  1731. not SIMPLE-ERROR.
  1732.  
  1733.  
  1734.                CHAPTER 90: Platform independent Extensions
  1735.                -------------------------------------------
  1736.  
  1737. 90.1. Saving an Image
  1738. ---------------------
  1739.  
  1740. The function (SAVEINITMEM [filename [:quiet] [:init-function]]) saves the
  1741. running CLISP's memory to a file. The filename defaults to "lispinit.mem".
  1742. If the :QUIET argument is not NIL, the startup banner and the good-bye
  1743. message will be suppressed. The :INIT-FUNCTION argument specifies a function
  1744. that will be executed at startup of the saved image.
  1745.  
  1746. 90.2. Quitting Lisp
  1747. -------------------
  1748.  
  1749. The functions (EXIT [errorp]), (QUIT [errorp]) and (BYE [errorp])
  1750. - all synonymous - terminate CLISP. If errorp is not NIL, CLISP aborts with
  1751. error status, i.e. the environment is informed that the CLISP session didn't
  1752. succeed.
  1753.  
  1754. 90.3. The Language
  1755. ------------------
  1756.  
  1757. The language CLISP uses to communicate with the user can be either
  1758. ENGLISH or DEUTSCH (i.e. german) or FRANCAIS (i.e. french). The macros
  1759. ENGLISH, DEUTSCH, FRANCAIS and LANGUAGE-CASE produce code that depends on
  1760. the language:
  1761. (ENGLISH english-form DEUTSCH deutsch-form FRANCAIS francais-form)
  1762. - and all permutations of this - evaluates all of english-form, deutsch-form,
  1763. francais-form in no particular order and returns the evaluation result
  1764. corresponding to the user language.
  1765. (LANGUAGE-CASE {clause}*) executes the clause (analogous to CASE) that
  1766. corresponds to the user language.
  1767. The language itself is the value of
  1768. (ENGLISH 'ENGLISH DEUTSCH 'DEUTSCH FRANCAIS 'FRANCAIS).
  1769.  
  1770. 90.4. Finalization
  1771. ------------------
  1772.  
  1773. Calling (FINALIZE object function) has the effect that when the specified
  1774. object is being garbage collected, (FUNCALL function object) will be executed.
  1775.  
  1776. Calling (FINALIZE object function guardian) has a similar effect, but only
  1777. as long as the "guardian" has not been garbage collected: When object is
  1778. being garbage collected, (FUNCALL function object guardian) will be executed.
  1779. If the guardian is garbage collected before object is, nothing happens.
  1780.  
  1781. Note: The time when "object is being garbage collected" is not defined
  1782. deterministically. (Actually, it possibly never occurs.) It denotes a moment
  1783. at which no references to object exist from other Lisp objects. When the
  1784. function is called, object (and possibly guardian) enter the "arena of live
  1785. Lisp objects" again.
  1786.  
  1787. No finalization request will be executed more than once.
  1788.  
  1789.  
  1790.                   CHAPTER 91: The Debugger and Stepper
  1791.                   ------------------------------------
  1792.  
  1793. The debugger may be invoked through the functions INVOKE-DEBUGGER, BREAK,
  1794. SIGNAL, ERROR, CERROR, WARN. The stepper is invoked through the macro STEP.
  1795. Debugger and stepper execute subordinate READ - EVAL - PRINT loops (called
  1796. "break loops") which are analogous to the main READ - EVAL - PRINT loop except
  1797. for the prompt and the set of available commands. Commands must be typed
  1798. literally, without surrounding quotes or white space.
  1799.  
  1800. Commands common to the main loop, the debugger and the stepper:
  1801.   Help       prints a list of available commands.
  1802.  
  1803. Commands common to the debugger and the stepper:
  1804.   Abort      and
  1805.   Unwind     abort to the next most recent READ - EVAL - PRINT loop.
  1806.  
  1807. The stack is organized into frames and other stack elements. Usually every
  1808. invocation of an interpreted function and every evaluation of an interpreted
  1809. form corresponds to one stack frame. Special forms such as LET, LET*,
  1810. UNWIND-PROTECT and CATCH produce special kinds of stack frames.
  1811.  
  1812. In a break loop there is a current stack frame, which is initially the most
  1813. recent stack frame but can be moved using the debugger commands Up and Down.
  1814.  
  1815. Evaluation of forms in a break loop occurs in the lexical environment of the
  1816. current stack frame but in the dynamic environment of the debugger's caller.
  1817. This means that to inspect or modify a lexical variable all you have to do
  1818. is to move to the current stack frame just below the frame that corresponds
  1819. to the form or the function call that binds that variable.
  1820.  
  1821. There is a current "stack mode" which defines in how much detail the stack
  1822. is shown by the stack related debugger commands.
  1823.  
  1824. Commands common to the debugger and the stepper:
  1825.   Mode-1      sets the current mode to 1: all the stack elements are
  1826.               considered. This mode is fine for debugging compiled functions.
  1827.   Mode-2      sets the current mode to 2: all the frames are considered.
  1828.   Mode-3      sets the current mode to 3: only lexical frames (frames that
  1829.               correspond to special forms that modify the lexical environment)
  1830.               are considered.
  1831.   Mode-4      sets the current mode to 4 (the default): only EVAL and APPLY
  1832.               frames are considered. Every evaluation of a form in the
  1833.               interpreter corresponds to an EVAL frame.
  1834.   Mode-5      sets the current mode to 5: only APPLY frames are considered.
  1835.               Every invocation of an interpreted function corresponds to one
  1836.               APPLY frame.
  1837.   Where       shows the current stack frame.
  1838.   Up          goes up one frame, i.e. to the caller if in mode-5
  1839.   Down        does down one frame, i.e. to the callee if in mode-5
  1840.   Top         goes to top frame, i.e. to the top-level form if in mode-4
  1841.   Bottom      goes to bottom (most recent) frame, i.e. most probably to the
  1842.               form or function that caused the debugger to be entered.
  1843.   Backtrace   lists the stack in current mode, bottom frame first, top frame
  1844.               last.
  1845.   Backtrace-1 lists the stack in mode 1.
  1846.   Backtrace-2 lists the stack in mode 2.
  1847.   Backtrace-3 lists the stack in mode 3.
  1848.   Backtrace-4 lists the stack in mode 4.
  1849.   Backtrace-5 lists the stack in mode 5.
  1850. If the current stack frame is an EVAL or APPLY frame, the following commands
  1851. are available as well:
  1852.   Break+      sets a breakpoint in the current frame. When the corresponding
  1853.               form or function will be left, the debugger will be entered
  1854.               again, with the variable *TRACE-VALUES* containing a list of
  1855.               its values.
  1856.   Break-      removes a breakpoint from the current frame.
  1857.   Redo        re-evaluates the corresponding form or function call. This
  1858.               command can be used to restart parts of a computation without
  1859.               aborting it entirely.
  1860.   Return      leaves the current frame. You will be prompted for the
  1861.               return values.
  1862.  
  1863. Commands specific to the debugger:
  1864.   Continue    continues evaluation of the program.
  1865.  
  1866. Commands specific to the stepper:
  1867.   Step        step into a form: evaluate this form in single step mode
  1868.   Next        step over a form: evaluate this form at once
  1869.   Over        step over this level: evaluate at once up to the next return
  1870.   Continue    switch off single step mode, continue evaluation
  1871.  
  1872. The stepper is usually used like this: If some form returns a strange value
  1873. or results in an error, call  (STEP form)  and navigate using the commands
  1874. Step  and  Next  until you reach the form you regard as responsible. If you
  1875. are too fast (execute Next once and get the error), there is no way back; you
  1876. have to restart the entire stepper session. If you are too slow (stepped into
  1877. a function or a form which certainly is OK), a couple of Next commands or one
  1878. Over command will help.
  1879.  
  1880.  
  1881.                 CHAPTER 99: Platform specific Extensions
  1882.                 ----------------------------------------
  1883.  
  1884. 99.2. Random Screen Access
  1885. --------------------------
  1886.  
  1887. (SCREEN:MAKE-WINDOW)
  1888.   returns a "window stream". As long as this stream is open, the terminal
  1889.   is in cbreak/noecho mode. *TERMINAL-IO* shouldn't be used for input or
  1890.   output during this time. (Use WITH-KEYBOARD and *KEYBOARD-INPUT* instead.)
  1891.  
  1892. (SCREEN:WITH-WINDOW . body)
  1893.   binds SCREEN:*WINDOW* to a window stream and executes body. The stream is
  1894.   guaranteed to be closed when the body is left. During its execution,
  1895.   *TERMINAL-IO* shouldn't be used, as above.
  1896.  
  1897. (SCREEN:WINDOW-SIZE window-stream)
  1898.   returns the window's size, as two values:
  1899.   height (= Ymax+1) and width (= Xmax+1).
  1900.  
  1901. (SCREEN:WINDOW-CURSOR-POSITION window-stream)
  1902.   returns the position of the cursor in the window, as two values:
  1903.   line (>=0, <=Ymax, 0 means top), column (>=0, <=Xmax, 0 means left margin).
  1904.  
  1905. (SCREEN:SET-WINDOW-CURSOR-POSITION window-stream line column)
  1906.   sets the position of the cursor in the window.
  1907.  
  1908. (SCREEN:CLEAR-WINDOW window-stream)
  1909.   clears the window's contents and puts the cursor in the upper left corner.
  1910.  
  1911. (SCREEN:CLEAR-WINDOW-TO-EOT window-stream)
  1912.   clears the window's contents from the cursor position to the end of window.
  1913.  
  1914. (SCREEN:CLEAR-WINDOW-TO-EOL window-stream)
  1915.   clears the window's contents from the cursor position to the end of line.
  1916.  
  1917. (SCREEN:DELETE-WINDOW-LINE window-stream)
  1918.   removes the cursor's line, moves the lines below it up by one line and
  1919.   clears the window's last line.
  1920.  
  1921. (SCREEN:INSERT-WINDOW-LINE window-stream)
  1922.   inserts a line at the cursor's line, moving the lines below it down by
  1923.   one line.
  1924.  
  1925. (SCREEN:HIGHLIGHT-ON window-stream)
  1926.   switches highlighted output on.
  1927.  
  1928. (SCREEN:HIGHLIGHT-OFF window-stream)
  1929.   switches highlighted output off.
  1930.  
  1931. (SCREEN:WINDOW-CURSOR-ON window-stream)
  1932.   makes the cursor visible, a cursor block in most implementations.
  1933.  
  1934. (SCREEN:WINDOW-CURSOR-OFF window-stream)
  1935.   makes the cursor invisible, in implementations where this is possible.
  1936.  
  1937. 99.5. ARexx
  1938. -----------
  1939.  
  1940. CLISP comes with a small yet extensible and powerful ARexx interface.
  1941.  
  1942. (REXX-DO-COMMAND "return address()" :STRING T :RESULT T) tells you the
  1943. name of the CLISP ARexx port. The default extension for CLISP ARexx
  1944. scripts is "cl".
  1945.  
  1946. (REXX-DO-COMMAND command &KEY :string :result :token :io)
  1947.   -> (RC &OPTIONAL RESULT), or NIL on failure
  1948.  
  1949. (REXX-RUN-COMMAND command &KEY :string :token)
  1950.   -> T, or NIL on failure
  1951.  
  1952. (REXX-SEND-COMMAND command &KEY :string :result :token :io :async)
  1953.   -> arexx-msg-handle, or NIL on failure
  1954.  
  1955. (REXX-WAIT-SENT-COMMAND arexx-msg-handle)
  1956.   -> (RC &OPTIONAL RESULT), or NIL on failure
  1957.  
  1958. (REXX-LOOP)
  1959.   -> no return, use the exit-loop.cl ARexx script to abort the loop
  1960.  
  1961. Command may be a string denoting a command with optional arguments or a
  1962. vector of strings thus denoting an ARexx function call. The first
  1963. element in the vector is the function name, the others are the up to 15
  1964. arguments.
  1965.  
  1966. ARexx server mode: Like Ispell, Csh and SKsh, you can run it in server
  1967. mode by calling (REXX-LOOP). You can then only exit with the ARexx
  1968. exit-loop.cl script.
  1969.  
  1970. Restrictions: Currently CLISP is not able to wait for input from
  1971. several sources, e.g. both a console and ARexx, at the same time.
  1972.  
  1973. 99.9. Other
  1974. -----------
  1975.  
  1976. To have *DEBUG-IO* and *ERROR-OUTPUT* point to separate console windows
  1977. (thus keeping your standard console window clean from error messages)
  1978. you can use
  1979.   (SETQ *ERROR-OUTPUT*
  1980.     (SETQ *DEBUG-IO*
  1981.       (OPEN "CON:0/0/500/300/CLISP-Debugger/AUTO/CLOSE" :DIRECTION :IO)
  1982.   ) )
  1983. at startup.
  1984.  
  1985.  
  1986. Authors:
  1987. --------
  1988.  
  1989.         Bruno Haible                    Michael Stoll
  1990.         Augartenstraße 40               Gallierweg 39
  1991.     D - 76137 Karlsruhe             D - 53117 Bonn
  1992.         Germany                         Germany
  1993.  
  1994. Maintainer:  marcus@sysc.pdx.edu
  1995.              haible@ma2s2.mathematik.uni-karlsruhe.de
  1996.