\section[Implementation Notes for CLISP]{Implementation Notes for CLISP\footnote{Last modified: 13 August 1994. Written by Bruno Haible and Michael Stoll.}}

This implementation is mostly compatible to the standard reference:

\begin{description}
\item[\rm Guy L. Steele Jr.,] {\it Common LISP: the Language}, (1st ed.).
       Digital Press 1984, 465 pages.
       (``CLtL1'' for short)
\end{description}

\noindent and to the older parts of:

\begin{description}
\item[\rm Guy L. Steele Jr.,] {\it Common LISP: the Language}, (2nd ed.).
       Digital Press 1990, 1032 pages.
       (``CLtL2'' for short)
\end{description}


These notes document the differences of the CLISP implementation of Common
Lisp to the standard CLtL1, and some implementation details.

The differences between CLtL1 and CLtL2 are made up of X3J13 votes. CLISP's
position with respect to these votes is listed in appendix.


\subsection{Chapter 1: Introduction}

No notes.


\subsection{Chapter 2: Data Types}

All the data types are implemented: numbers, characters, symbols, lists,
arrays, hash tables, readtables, packages, pathnames, streams, random
states, structures and functions.

\paragraph{2.1.3.}

There are four floating point types: {\tt short-float}, {\tt single-float},\\{\tt double-float}
and {\tt long-float}:

\begin{center}\begin{tabular}{|l|c|r|r|l|}\hline
 &sign&\multicolumn{1}{|c|}{mantissa}&\multicolumn{1}{|c|}{exponent}&\\\hline
 \tt  short-float  &1 bit&$16+1$ bits &  8 bits&\\
\tt   single-float&1 bit&$23+1$ bits&   8 bits&   CLISP uses IEEE format\\
\tt   double-float&1 bit&$52+1$ bits&  11 bits&   CLISP uses IEEE format\\
\tt   long-float  &1 bit&${}\ge 64$ bits&  32 bits& \\\hline
	 \end{tabular}
\end{center}

The  single and double float  formats  are those  of the IEEE standard
(1981),  except that CLISP  does  not support  features like {\tt +0},
{\tt    -0}, {\tt +inf},   {\tt  -inf}, gradual  underflow, {\tt NaN},
etc. (Common Lisp does not make use of these features.)

Long floats  have variable mantissa length, which  is a multiple of 16
(or 32, depending  on  the word size   of the processor).  The default
length used   when long floats are  read  is given  by the  place {\tt
(long-float-digits)}. It can be set by \verb+(setf (long-float-digits)
+$nnn${\tt)}, where $nnn$ is a positive integer.

\paragraph{2.1.4.}
Complex numbers  can   have a real   part  and an   imaginary  part of
different  types. For  example,   {\tt (sqrt  -9.0)}  evaluates to the
number \verb+#C(0 3.0)+, which has a real part of  exactly 0, not only
0.0 (which  would mean {\it approximately  0\/}).   The type specifier
for this is {\tt (complex integer single-float)}, and

\medskip\noindent\verb+(complex +{\it type-of-real-part type-of-imaginary-part}{\tt)}

\medskip\noindent in general.
The type specifier {\tt (complex {\it}type)} is equivalent to 
{\tt (complex {\it type type})}.

\paragraph{2.2.1.}

The characters are ordered according to the ASCII encoding.

More precisely, CLISP uses the ISO Latin-1 (ISO 8859-1) character set:
%\font\wasy=wasy10
%\input wasyfont
\font\cmoer=cmoer10% scaled 900

\begin{center}\noindent\begin{tabular}{|c|cccccccccccccccc|}\cline{2-17}
\multicolumn{1}{l|}{\null}&
\$0&\$1&\$2&\$3&\$4&\$5&\$6&\$7&\$8&\$9&\$A&\$B&\$C&\$D&\$E&\$F\\\hline
\$00&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**\\
\$10&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**&\tt**\\
\$20& & !& " &\#&\$ &\%&\&& '&  ( & )&  * & + & , & $-$ & .&  /\\
\$30&0&1&2&3&4&5&6&7&8&9&:&;&$<$&=&$>$&?\\
\$40&@&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O\\
\$50&P&Q&R&S&T&U&V&W&X&Y&Z&[&$\backslash$&]&\^{}&\underline{\ \ }\\
\$60&`&a&b&c&d&e&f&g&h&i&j&k&l&m&n&o\\
\$70&p&q&r&s&t&u&v&w&x&y&z&\{&$|$&\}&\~{}& \\
\$80&&&&&&&&&&&&&&&&\\                                               
\$90&&&&&&&&&&&&&&&&\\                                                
\$A0& &<&\cent&{\it\char"24}&\currency&\yen&$\stackrel{\vrule depth 0pt height 5pt width .4pt}{\vrule depth 2pt height 3pt width .4pt}$&$\mathchar "278$&\"{}&\copyright&${}^{\mbox{\scriptsize\underline{a}}}$&\ly(\kern-0.13em(&\tenmsx\char '161&-&\circledR&--\\
\$B0&\char"17&$\pm$&${}^2$&${}^3$&'&$\mu$&$\mathchar "27B$&$\cdot$&\c{}&${}^1$&${}^{\mbox{\scriptsize\underline{o}}}$&\ly)\kern-0.13em)&$\frac{1}{4}$&$\frac{1}{2}$&$\frac{3}{4}$&>\\
\$C0&\`A&\'A&\^A&\~A&\"A&\AA&\AE&\c C&\`E&\'E&\^E&\"E&\`I&\'I&\^I&\"I\\
\$D0&\cmoer D&\~N&\`O&\'O&\^O&\~O&\"O&$\times$&\O&\`U&\'U&\^U&\"U&\'Y&\cmoer T&\ss\\
\$E0&\`a&\'a&\^a&\~a&\"a&\aa&\ae&\c c&\`e&\'e&\^e&\"e&\`\i&\'\i&\^\i&\"\i\\
\$F0&\cmoer d&\~n&\`o&\'o&\^o&\~o&\"o&$\div$&\o&\`u&\'u&\^u&\"u&\'y&\cmoer t&\"y \\\hline
\end{tabular}
\end{center}


\medskip 
Here {\tt**} are    control characters, not  graphic characters.  (The
characters left  blank  here cannot be   represented in this character
set).

The following are standard characters:
\begin{tabbing}
\verb+#\Backspace+ \=\kill
\verb+#\Space+ \>              \$20\\
\verb+#\Newline+  \>          \$0A
\end{tabbing}

The following are semi-standard characters:
\begin{tabbing}
\verb+#\Backspace+ \=         \$08\\
\verb+#\Tab+     \>            \$09\\
\verb+#\Linefeed+   \>         \$0A\\
\verb+#\Page+      \>          \$0C\\
\verb+#\Return+   \>           \$0D\\
\verb+#\Rubout+   \>           \$7F
\end{tabbing}

\paragraph{2.2.2.}

\verb+#\Newline+ is the delimiter between lines.

When reading from a file, CR/LF is converted to \verb+#\Newline+, and CR not
followed by LF is read as \verb+#\Return+.

\paragraph{2.2.3.}

There are the following additional characters with names:
\begin{tabbing}
\verb+#\Backspace+ \=\kill
\verb+#\Null+\>                \$00\\
\verb+#\Bell+\>                \$07\\
\verb+#\Escape+\>            \$1B
\end{tabbing}


\paragraph{2.2.4.}

The code of a character is ${}\ge0$, ${}<256$. $\mbox{\tt CHAR-CODE-LIMIT} = 256$.

There are fonts 0 to 15, and $\mbox{\tt CHAR-FONT-LIMIT} = 16$. But the system itself
uses only font 0.

\begin{sloppypar}
The  following bits attributes   are implemented: {\tt :control}, {\tt
:meta},     {\tt  :super},   {\tt   :hyper}.     Therefore  $\mbox{\tt
CHAR-FONT-LIMIT} =  16$.   The system itself uses  these  bits only to
mention special keys and Control/Alternate/Shift  key status on return
from \verb+(read-char *keyboard-input*)+.
\end{sloppypar}

\paragraph{2.5.}

The maximum rank (number of dimensions) of an array is 65,535 on 16-bit
processors, 4,294,967,295 on 32-bit processors.

\paragraph{2.13.}

All the functions built by {\tt function},  {\tt compile} and the like
are  atoms.   There are  built-in   functions written  in C,  compiled
functions  (both of  type  {\tt  compiled-function})  and  interpreted
functions (of type  {\tt   function}).  The  possible function   names
(CLtL1 p. 59) are symbols and lambda expressions.

\paragraph{2.14.}

This is the list of objects whose external representation can not be
meaningfully read in:

\begin{tabbing}
\verb+#<compiled-closure name>+ \=\kill
all structures lacking a keyword constructor.\\
all arrays except strings, if $\mbox{\tt*PRINT-ARRAY*} = {\tt nil}$.\\
\verb+#<system-function name>+\>    built-in function written in C\\
\verb+#<special-form name>+\>      special form handler\\
\verb+#<compiled-closure name>+\>   compiled function, if $\mbox{\tt*PRINT-CLOSURE*} = {\tt nil}$\\
\verb+#<closure name ...>+\>         interpreted function\\
\verb+#<frame-pointer #x...>+\>      pointer to a stack frame\\
\verb+#<disabled pointer>+\>         frame pointer which has become invalid on exit from the corresponding {\tt block}\\\> or {\tt tagbody}\\
\verb+#<...-stream ...>+\>           stream\\
\verb+#<package name>+\>             package\\
\verb+#<hash-table #x...>+\>         hash table, if $\mbox{\tt*PRINT-ARRAY*} = {\tt nil}$\\
\verb+#<readtable #x...>+\>          readtable\\
\verb+#<unbound>+\>      {\it value} of a symbol without value, {\it value} of an unsupplied optional or keyword\\
                            \>  argument\\
\verb+#<special reference>+\>    environment marker for variables declared {\tt special}\\
\verb+#<dot>+\>                 internal {\tt read} result for ``{\tt.}''\\
\verb+#<end of file>+\>  internal {\tt read} result, when the end of file is reached\\
\verb+#<read-label ...>+\>    intermediate {\tt read} result for \verb+#n#+\\
\verb+#<address #x...>+\>            machine address, should not occur\\
\verb+#<SYSTEM-POINTER #x...>+\>     should not occur
\end{tabbing}

\paragraph{2.15.}

The type {\tt number} is  the disjoint union of  the types {\tt  real}
and {\tt complex}.  (CLtL wording: ``exhaustive partition'')  The type
{\tt real} is the disjoint union of the types  {\tt rational} and {\tt
float}.   The type {\tt rational} is  the disjoint union  of the types
{\tt integer} and {\tt ratio}.  The type {\tt integer} is the disjoint
union of the types {\t fixnum} and {\tt bignum}.  The type {\tt float}
is  the  disjoint   union  of  the   types   {\tt  short-float},  {\tt
single-float}, {\tt double-float} and {\tt long-float}.


\subsection{Chapter 3: Scope and Extent}

is implemented as described.


\subsection{Chapter 4: Type Specifiers}

\paragraph{4.4.}

The CLtL2 type specifier {\tt (eql {\it object})}  denotes the singleton set\\
\verb+{+{\it object}\verb+}+.

\paragraph{4.5.}

The general form of the {\tt complex} type specifier is:

\medskip\noindent\verb+(complex +{\it type-of-real-part type-of-imaginary-part}{\tt )}

\medskip
The type  specifier {\tt (complex {\it  type})}  is equivalent to {\tt
(complex {\it type type})}.

\paragraph{4.6.}

The CLtL2   type  specifier {\tt  (real {\it low   high})} denotes  the real
numbers between {\it low} and {\it high}.

\paragraph{4.7.}

{\tt deftype} lambda lists are subject to destructuring (nested lambda
lists   are allowed,   as in    {\tt   defmacro}) and  may contain   a
\verb+&whole+ marker, but no \verb+&environment+ marker.

\paragraph{4.9.}

The possible results of {\tt type-of} are:
\begin{itemize}
\item {\tt cons}
\item {\tt symbol}, {\tt  null}
\item {\tt fixnum}, {\tt  bignum}, {\tt  ratio}, {\tt  short-float}, 
{\tt single-float}, {\tt  double-float}, {\tt  long-float}, {\tt  complex}
\item {\tt character}
\item ({\tt array {\it element-type dimensions})},
{\tt (simple-array {\it element-type dimensions})}
\item {\tt (vector t {\it size})}, ({\tt simple-vector {\it size})}
\item {\tt (string {\it size})}, {\tt (simple-string {\it size})}
\item {\tt (bit-vector {\it size})}, {\tt (simple-bit-vector {\it size})}
\item {\tt function}, {\tt  compiled-function}
\item {\tt stream}, {\tt  package}, {\tt  hash-table}, {\tt  readtable}, 
{\tt  pathname}, {\tt  random-state}
\item {\tt byte}, {\tt load-time-eval}, {\tt  symbol-macro}, 
{\tt  read-label}, {\tt  frame-pointer}, {\tt system-internal}
\item {\tt address} (should not occur)
\item any other symbol (structure types or CLOS classes)
\item a class (CLOS classes without proper name)
\end{itemize}


\subsection{Chapter 5: Program Structure}

\paragraph{5.1.3.}

\begin{sloppypar}
In addition  to the 24  special forms listed on p.  57 (CLtL2: p. 73),
the CLtL2   special forms {\tt  locally},  {\tt symbol-macrolet}, {\tt
load-time-value} are implemented,   and the macros  {\tt psetq},  {\tt
prog1},  {\tt prog2},   {\tt when},  {\tt  unless}, {\tt  cond}, {\tt
multiple-value-list},    {\tt         multiple-value-bind},       {\tt
multiple-value-setq}, {\tt and},  {\tt or} are  implemented as special
forms.
\end{sloppypar}

Constants may not be bound dynamically or lexically.

\paragraph{5.2.2.}\leavevmode

\begin{verbatim}
lambda-list-keywords =
    (&optional &rest &key &allow-other-keys &aux &body &whole &environment)
\end{verbatim}

{\tt   lambda-parameters-limit}  is   65,536 on   16-bit   processors,
4,294,967,296 on 32-bit processors.

\paragraph{5.3.}

{\tt defun} and {\tt defmacro} are allowed in non-toplevel positions.
As an example, consider the definition of {\tt gensym}:
\begin{verbatim}
(let ((gensym-prefix "G")
      (gensym-count 1))
  (defun gensym (&optional (x nil s))
    (when s
      (cond ((stringp x) (setq gensym-prefix x))
            ((integerp x)
             (if (minusp x)
               (error "~S: index ~S is negative" 'gensym x)
               (setq gensym-count x)
            ))
            (t (error "~S: argument ~S of wrong type" 'gensym x))
    ) )
    (prog1
      (make-symbol
        (concatenate 'string
          gensym-prefix
          (write-to-string gensym-count :base 10 :radix nil)
      ) )
      (incf gensym-count)
) )
\end{verbatim}

\begin{sloppypar}
\paragraph{5.3.2.}

 \verb+(proclaim '(special +{\it var}{\tt))} declarations may  not be undone. The
same holds for {\tt  defvar}, {\tt defparameter} and {\tt defconstant}
declarations.
\end{sloppypar}

\begin{sloppypar}
It is an error if a {\tt defconstant}  variable is bound at the moment
the  {\tt  defconstant} is  executed,  but  {\tt defconstant} does not
check this.
\end{sloppypar}

Constants may not be bound dynamically or lexically.


\subsection{Chapter 6: Predicates}

\paragraph{6.2.2.}

{\tt realp} returns  {\tt t} is its   argument is a real  number, {\tt
nil} otherwise.

{\tt  compiled-function-p}  returns  {\tt   t} on  built-in  functions
written in C, compiled  functions and special form handlers. Therefore
{\tt compiled-function} is not a subtype of {\tt function}.

\paragraph{6.3.}

{\tt eq}     compares characters and fixnums as     {\tt eql} does. No
unnecessary copies are made of  characters and numbers.  Nevertheless,
one should use {\tt eql}.

\verb+(let ((x y)) (eq x x))+ always returns {\tt t}, regardless of {\tt y}.

\paragraph{6.4.}

{\tt and} and {\tt or} are implemented as  special forms and, as such,
rather efficient.


\subsection{Chapter 7: Control Structure}

\paragraph{7.1.1.}

 {\tt (function {\it symbol})} returns   the  local   function   definition
established by {\tt flet} or {\tt labels}, if it exists, otherwise the
global function definition.

The CLtL2 place {\tt(fdefinition {\it function-name})} is implemented.

\begin{sloppypar}
{\tt (special-form-P {\it symbol})} returns {\tt nil}  or {\tt t}.  If
it returns {\tt t}, then {\tt  (symbol-function {\it symbol})} returns
the (useless) special form handler.
\end{sloppypar}

\paragraph{7.1.2.}

{\tt psetq} is implemented as a special form and, as such, rather efficient.

\begin{sloppypar}
\paragraph{7.2.}

 {\tt(setf (symbol-function {\it   symbol})  {\it object})}  requires
{\it  object} to be either a  function, a {\tt symbol-function} return
value  or a  lambda     expression. A  lambda expression  is   thereby
immediately converted to a function.
\end{sloppypar}

{\tt setf} also accepts places yielding multiple values.

Additional places:

\begin{description}
\item[\tt funcall\rm:]\leavevmode

  \verb+(setf  (funcall  #'+{\it symbol}{\tt  ...) {\it  object})} and
  \\\verb+(setf  (funcall  '+{\it symbol}{\tt  ...) {\it object})} are
  equivalent to \\{\tt(setf ({\it symbol} ...)  {\it object})}.

\item[\tt get-dispatch-macro-character\rm:]\leavevmode

  \verb+(setf (get-dispatch-macro-character ...) ...)+
  performs a {\tt set-dispatch-macro-character}.

\item[\tt long-float-digits\rm:]\leavevmode

  {\tt (setf  (long-float-digits)  {\it digits})} sets the  default mantissa
  length of long floats to {\it digits} bits.

\item[\tt values\rm:]\leavevmode

  {\tt (setf (values place1 ... placek) form)} is approximately equivalent to
\begin{verbatim}
     (multiple-value-bind (dummy1 ... dummyk) form
       (setf place1 dummy1 ... placek dummyk)
       (values dummy1 ... dummyk)
     )
\end{verbatim}

  Example:
    {\tt (setf (values a b) (values b a))} interchanges the values of {\tt a} and {\tt b}.

\item[\tt  values-list\rm:]\leavevmode

  {\tt (setf (values-list {\it list}) {\it form})}  is equivalent to\\
  {\tt (values-list (setf {\it list} (multiple-value-list {\it form})))}
\end{description}

 \verb+&key+ markers in {\tt defsetf} lambda  lists are supported, but
the corresponding keywords must appear literally in the program text.

\begin{sloppypar}
{\tt(get-setf-method {\it form} \&optional {\it env})} and
{\tt (get-setf-method-multiple-value {\it form} \&optional {\it env})}
receives as  optional  argument the  environment  necessary  for macro
expansions.  In {\tt define-setf-method} lambda lists, one can specify
\verb+&environment+  and a  variable,   which  will be  bound   to the
environment. This  environment should be  passed to all calls  of {\tt
get-setf-method} and {\tt get-setf-method-multiple-value}.  If this is
done, even local macros will be interpreted as places correctly.
\end{sloppypar}

\paragraph{7.3.}

{\tt call-arguments-limit}    is   65,536  on     16-bit   processors,
4,294,967,296 on 32-bit processors.

\paragraph{7.4.}

{\tt prog1}  and {\tt prog2} are implemented  as special forms and, as
such, rather efficient.

\paragraph{7.5.}

The CLtL2 special form {\tt symbol-macrolet} is implemented.

\begin{sloppypar}
The macro   {\tt define-symbol-macro} establishes  symbol  macros with
global  scope  (as opposed    to  symbol  macros  defined  with   {\tt
symbol-macrolet}, which  have local scope):  {\tt (define-symbol-macro
symbol expansion)}. Calling {\tt boundp},  {\tt symbol-value} or  {\tt
makunbound} on symbols defined as symbol macros is not allowed.
\end{sloppypar}

If using the optional package {\tt macros3}:
\begin{quote}
  The macros {\tt  letf} and {\tt letf*}  are like {\tt  let} and {\tt
  let*},  resp., except  that they  can bind places,  even places with
  multiple values.

  Example:
  
  {\tt   (letf (((values  a b) {\it form}))     ...)} is equivalent  to {\tt
  (multiple-value-bind (a b) {\it form} ...)}

  {\tt (letf (((first l) 7)) ...)}
  is approximately equivalent to:
\begin{verbatim}
    (let* ((#:g1 l) (#:g2 (first #:g1)))
      (unwind-protect (progn (setf (first #:g1) 7) ...)
                      (setf (first #:g1) #:g2)
    ) )
\end{verbatim}
\end{quote}

\paragraph{7.6.}

{\tt when}, {\tt unless}, {\tt  cond} are implemented as special forms
and, as such, rather efficient.

\paragraph{7.8.4.}

The function {\tt mapcap} is like {\tt mapcan}, except that it concatenates the
resulting lists with {\tt append} instead of {\tt nconc}:\\
$\mbox{\tt (mapcap fun x1 ... xn)} \equiv\mbox{\tt (apply \#'append (mapcar fun x1 ... xn))}$

\noindent(Actually a bit more efficient that this would be.)

The function {\tt maplap} is like {\tt mapcon}, except that it concatenates the
resulting lists with {\tt append} instead of {\tt nconc}:\\
$\mbox{\tt  (maplap fun x1 ... xn)}\equiv\mbox{\tt (apply \#'append (maplist fun x1 ... xn))}$

\noindent(Actually a bit more efficient that this would be.)

\paragraph{7.9.1.}

$\mbox{\tt multiple-values-limit} = 128$

{\tt    multiple-value-list}, {\tt   multiple-value-bind},        {\tt
multiple-value-setq} are implemented  as special  forms and, as  such,
rather efficient.

The macro  {\tt nth-value}:   {\tt  (nth-value n form)}    returns the
$(n+1)\mbox{st}$ value ($n\ge0$) of form.


\subsection{Chapter 8: Macros}

\paragraph{8.3.}

The CLtL2 macro {\tt destructuring-bind} is implemented. It does not perform
full error checking.


\subsection{Chapter 9: Declarations}

\paragraph{9.1.}

The CLtL2 macro {\tt declaim} is implemented.

\paragraph{9.2.}

%\begin{sloppypar}
The declarations {\tt (type {\it type var} ...)}, {\tt (ftype {\it type fun}
...)}, {\tt (function {\it name arglist result-type})}, {\tt (optimize
(quality {\it value}) ...)}  are ignored by the interpreter and the
compiler.
%\end{sloppypar}

The CLtL2 declaration ({\tt optimize (debug ...))} is legal.

\medskip
Additional declaration:

  \begin{quote} The declaration  {\tt  (compile)} has the effect  that
  the current form is compiled prior to execution.

  Examples:\\
  {\tt (locally (declare (compile)) {\it form})}
  executes a compiled version of {\it form}.
  \begin{verbatim}
  (let ((x 0))
    (flet ((inc () (declare (compile)) (incf x))
           (dec () (decf x)))
      (values #'inc #'dec)
  ) )
\end{verbatim}
  returns two functions. The first is compiled and increments {\tt x}, the second
  is interpreted (slower) and decrements the same {\tt x}.
  \end{quote}

\paragraph{9.3.}

The type assertion {\tt (the value-type form)} enforces a type check in
interpreted code. No type check is done in compiled code.

If using the optional package {\tt macros3}:
{\tt (ethe value-type form)} enforces a type check in both interpreted and
compiled code.


\subsection{Chapter 10: Symbols}

No notes.


\subsection{Chapter 11: Packages}

\paragraph{11.6.}

The   package {\tt    SYSTEM}  has   the nicknames   {\tt  SYS}   and,
additionally, {\tt COMPILER}.

The CLtL2 packages:
\begin{itemize}
\item {\tt COMMON-LISP} with nickname {\tt CL} and
\item {\tt COMMON-LISP-USER} with nickname {\tt CL-USER}
\end{itemize}
 \noindent are implemented. The package {\tt COMMON-LISP} exports only
those symbols from the proposed ANSI {\tt  CL} draft that are actually
implemented.

\paragraph{11.7.}

The CLtL2 macro {\tt defpackage} is implemented.

\paragraph{11.8.}

The   function {\tt require} receives   as optional  argument either a
pathname or  a list of  pathnames: files to be  loaded if the required
module is not already in memory.


\subsection{Chapter 12: Numbers}

The single and double float  formats are  those  of the IEEE  standard
(1981),  except that  CLISP does not   support features like {\tt +0},
{\tt -0},   {\tt +inf}, {\tt   -inf}, gradual   underflow, {\tt  NaN},
etc. (Common Lisp does not make use of these features.)

The default number of mantissa bits in long floats is given by the place
{\tt (long-float-digits)}.

Example: {\tt  (setf   (long-float-digits) 3322)}   sets  the  default
precision of long floats to 1000 decimal digits.

\paragraph{12.1.}

Complex numbers    can have a  real   part and  an  imaginary  part of
different types. If the imaginary  part is {\tt  eql} to 0, the number
is automatically  converted to a real number.  (Cf. CLtL1 p. 195) This
has  the   advantage  that  {\tt (let  ((x   (sqrt  -9.0))) (* x  x))}
---instead of evaluting to {\tt\#C(-9.0  0.0)}, with {\tt x =  \#C(0.0
3.0)}--- evaluates to  {\tt\#C(-9.0 0)  = -9.0}, with  {\tt x  = \#C(0
3.0)}.

Coercions on operations involving different types:
the result of an arithmetic operation whose arguments are of different float
types is rounded to the float format of the shortest (least precise) of the
arguments.

$${\tt rational}\rightarrow\mbox{\tt long-float}\rightarrow\mbox{\tt double-float}\rightarrow\mbox{\tt single-float}\rightarrow\mbox{\tt short-float}$$
\noindent(in contrast to CLtL1 p. 195!)

\begin{description}
 \item[\rm Rationale:] See  it  mathematically. Add  intervals: $\{1.0
  \pm 1{\rm e}-8\} + \{1.0 \pm 1{\rm e}-16\} = \{2.0 \pm 1{\rm e}-8\}$
  So, if we   add {\tt 1.0s0} and   {\tt  1.0d0}, we  should  get {\tt
  2.0s0}.

\item[\rm Shortly:]
  Do not suggest accuracy of a result by giving it a precision that is
  greater than its accuracy.

\begin{sloppypar}
  Example:\\
  {\tt (- (+ 1.7 pi) pi)}  should not return  1.700000726342836417234L0,
  it should return 1.7f0 (or 1.700001f0 if there were rounding errors).
\end{sloppypar}

\item[\rm Experience:]
  If in a computation using thousands of short floats, a long float (like {\tt pi})
  happens to be used, the long precision should not propagate throughout all
  the intermediate values. Otherwise, the long result would look precise,
  but its accuracy is only that of a short float; furthermore much
  computation time would be lost by calculating with long floats when only
  short floats would be needed.
\end{description}


When rational  numbers  are to be converted   to floats  (due to  {\tt
float}, {\tt coerce},  {\tt sqrt} or  a  transcendental function), the
result type is given by the variable {\tt *default-float-format*}.

%\begin{sloppypar}
The      macro       {\tt         without-floating-point-underflow}:
  \verb+(without-floating-point-underflow {+{\it    form}\verb+}*)+
  executes    the   {\it     form},   with  errors     of   type  {\tt
  floating-point-underflow} inhibited.  Floating point operations will
  silently  return zero instead  of  signalling an error  of type {\tt
  floating-point-underflow}.
%\end{sloppypar}

\paragraph{12.4.}\leavevmode

\begin{description}
\item[\tt (lcm)], called without  arguments, returns {\tt  1}, which is the
neutral element of composition with {\tt lcm}.

\item[\tt (! {\it n})] returns the factorial of {\it n}, {\it n} a nonnegative integer.

 \item[\tt  (exquo {\it x y})] returns  the quotient ${\it x}/{\it y}$
of  two  integers {\it x}  and  {\it  y},  and checks   that  it is an
integer. (This is more efficient than {\tt /}.)

\item[\tt (xgcd  {\it x1} ... {\it xn})] returns  the values {\tt g},  {\tt c1},\ldots,
{\tt cn}, where {\tt g} is the greatest common divisor of the integers
{\it x1},\ldots ,{\it xn}, and  {\tt c1},\ldots, {\tt cn} are  integer
coefficients such that:\\
${\tt g} = \mbox{\tt (gcd  {\it x1} ... {\it xn})}  = \mbox{\tt (+ (* c1 {\it x1}) ... (* cn {\it xn}))}$
\end{description}

\paragraph{12.5.1.}\leavevmode

\begin{description}
\item[\tt (expt {\it base exponent})] is not very precise if {\it exponent} has large absolute
value.

\item[\tt (log number {\it base})] signals an error if ${\it base} = 1$.
\end{description}

\begin{sloppypar}
\paragraph{12.5.2.}

The value of {\tt pi} is a long float with the precision given by {\tt
(long-float-digits)}.   When this precision is   changed, the value of
{\tt   pi} is  automatically   recomputed.  Therefore {\tt  pi}  is  a
variable, not a constant.
\end{sloppypar}

\paragraph{12.6.}\leavevmode

\begin{description}
\item[\tt float-radix] always returns 2.

\item[\tt(float-digits {\it number digits})] coerces {\it number} (a real number) to a floating
point number with at least {\it digits} mantissa digits. The following holds:\\
   {\tt (>= (float-digits (float-digits {\it number digits})) {\it digits})}
\end{description}

\paragraph{12.7.}\leavevmode

\begin{tabbing}
\tt boole-andc2 \=\kill
\tt boole-clr\>   =  0\\
\tt boole-set \>  = 15\\
\tt boole-1   \>  = 10\\
\tt boole-2   \>  = 12\\
\tt boole-c1  \>  =  5\\
\tt boole-c2  \>  =  3\\
\tt boole-and \>  =  8\\
\tt boole-ior \> = 14\\
\tt boole-xor \>  =  6\\
\tt boole-eqv \>  =  9\\
\tt boole-nand\>  =  7\\
\tt boole-nor \>  =  1\\
\tt boole-andc1\> =  4\\
\tt boole-andc2\> =  2\\
\tt boole-orc1 \> = 13\\
\tt boole-orc2\>  = 11
\end{tabbing}

\paragraph{12.10.}\leavevmode

\noindent $\mbox{\tt most-positive-fixnum} = 2^{24}-1 = 16777215$

\noindent$\mbox{\tt most-negative-fixnum} = -2^{24} = -16777216$

\begin{sloppypar}
Together   with {\tt  pi},  the    other long  float constants \\   {\tt
most-positive-long-float}\\  {\tt    least-positive-long-float}\\  {\tt
least-negative-long-float}\\ {\tt   most-negative-long-float}\\   {\tt
long-float-epsilon}\\ {\tt long-float-negative-epsilon} \\ are recomputed
whenever {\tt (long-float-digits)} is changed. They are variables, not
constants.
\end{sloppypar}


\subsection{Chapter 13: Characters}

See first above: 2.2.

\paragraph{13.1.}

\begin{tabbing}
\tt char-code-limit \== 256\\
\tt char-font-limit\> = 16\\
\tt char-bits-limit\> = 16
\end{tabbing}

\paragraph{13.2.}

String-chars are those characters with font value 0 and bits value 0.

The graphic characters have been described above.

The standard characters are \verb+#\Newline+ and those graphic characters with a
code between 32 and 126 (inclusive).

The alphabetic characters are these string-chars:
\begin{verbatim}
             ABCDEFGHIJKLMNOPQRSTUVWXYZ
             abcdefghijklmnopqrstuvwxyz
\end{verbatim}
and the international alphabetic characters from the character set:\\
             \c Cue\'e\^{}\c a\ae\`aa\c c\^e\"e\`e\"\i\^\i\`\i\AE\c A\'E\ae\AE\^o\oe\`o\^u\`u\"y\OE Ue\ss\'a\'\i\'o\'u\~n\~Nao\~a\~oOo\`A\~A\~O etc.

\begin{sloppypar}
The    functions  {\tt     char-equal},  {\tt  char-not-equal},   {\tt
char-lessp},   {\tt  char-greaterp},   {\tt   char-not-greaterp}, {\tt
char-not-lessp} ignore bits and font attributes of their arguments.
\end{sloppypar}

\paragraph{13.4.}

The string chars that are not graphic chars and the space character have
names:

{\tt\begin{tabbing}
(code-char \#x00) {\rm =} \verb+#\Null+ {\rm =} \verb+#\Nul+\\
(code-char \#x01) {\rm =} \verb+#\Soh+\\
(code-char \#x02) {\rm =} \verb+#\Stx+\\
(code-char \#x03) {\rm =} \verb+#\Etx+\\
(code-char \#x04) {\rm =} \verb+#\Eot+\\
(code-char \#x05) {\rm =} \verb+#\Enq+\\
(code-char \#x06) {\rm =} \verb+#\Ack+\\
(code-char \#x07) {\rm =} \verb+#\Bell+ {\rm =} \verb+#\Bel+\\
(code-char \#x08) {\rm =} \verb+#\Backspace+ {\rm =} \verb+#\Bs+\\
(code-char \#x09) {\rm =} \verb+#\Tab+ {\rm =} \verb+#\Ht+\\
(code-char \#x0A) {\rm =} \verb+#\Newline+ {\rm =} \verb+#\Nl+ {\rm =} \verb+#\Linefeed+\\
(code-char \#x0B) {\rm =} \verb+#\Vt+\\
(code-char \#x0C) {\rm =} \verb+#\Page+ {\rm =} \verb+#\Np+\\
(code-char \#x0D) {\rm =} \verb+#\Return+ {\rm =} \verb+#\Cr+\\
(code-char \#x0E) {\rm =} \verb+#\So+\\
(code-char \#x0F) {\rm =} \verb+#\Si+\\
(code-char \#x10) {\rm =} \verb+#\Dle+\\
(code-char \#x11) {\rm =} \verb+#\Dc1+\\
(code-char \#x12) {\rm =} \verb+#\Dc2+\\
(code-char \#x13) {\rm =} \verb+#\Dc3+\\
(code-char \#x14) {\rm =} \verb+#\Dc4+\\
(code-char \#x15) {\rm =} \verb+#\Nak+\\
(code-char \#x16) {\rm =} \verb+#\Syn+\\
(code-char \#x17) {\rm =} \verb+#\Etb+\\
(code-char \#x18) {\rm =} \verb+#\Can+\\
(code-char \#x19) {\rm =} \verb+#\Em+\\
(code-char \#x1A) {\rm =} \verb+#\Sub+\\
(code-char \#x1B) {\rm =} \verb+#\Escape+ {\rm =} \verb+#\Esc+\\
(code-char \#x1C) {\rm =} \verb+#\Fs+\\
(code-char \#x1D) {\rm =} \verb+#\Gs+\\
(code-char \#x1E) {\rm =} \verb+#\Rs+\\
(code-char \#x1F) {\rm =} \verb+#\Us+\\
(code-char \#x20) {\rm =} \verb+#\Space+ {\rm =} \verb+#\Sp+\\
(code-char \#x7F) {\rm =} \verb+#\Rubout+ {\rm =} \verb+#\Delete+ {\rm =} \verb+#\Del+
    \end{tabbing}}

\paragraph{13.5.}\leavevmode

\begin{tabbing}
\tt char-control-bit \= = 1\\
\tt char-meta-bit\>    = 2\\
\tt char-super-bit\>   = 4\\
\tt char-hyper-bit\>   = 8
\end{tabbing}


\subsection{Chapter 14: Sequences}

\paragraph{14.1.}

The result of {\tt nreverse} is always  {\tt eq} to the argument. {\tt
nreverse} on  a vector  swaps pairs of  elements.  {\tt nreverse} on a
list  swaps  the  first  and the last   element and  reverses the list
chaining between them.

\paragraph{14.2.}

For iteration  through a sequence,  a macro  {\tt doseq}, analogous to
{\tt dolist}, may be used instead of {\tt map} :
\begin{verbatim}
(doseq (var seqform [resultform]) {declaration}* {tag|statement}* )
\end{verbatim}

The CLtL2 function {\tt map-into} is implemented.

\paragraph{14.3.}

{\tt   remove},   {\tt    remove-if},    {\tt   remove-if-not},   {\tt
remove-duplicates} return their argument unchanged,  if no element has
to be removed.

\begin{sloppypar}
{\tt    delete},  {\tt    delete-if},   {\tt   delete-if-not},    {\tt
delete-duplicates}    destructively  modify  their   argument:  if the
argument is a list, the {\tt cdr}  parts are modified. If the argument
is a vector with  fill pointer, the  fill  pointer is lowered  and the
remaining elements are compacted below the new fill pointer.
\end{sloppypar}

\paragraph{14.5.}

{\tt sort} and {\tt stable-sort} have two additional keywords {\tt :start} and {\tt :end}
\begin{verbatim}
  (sort sequence predicate &key :key :start :end)
  (stable-sort sequence predicate &key :key :start :end)
\end{verbatim}

{\tt sort}  and {\tt  stable-sort}  are identical. They implement  the
mergesort algorithm.


\subsection{Chapter 15: Lists}

\paragraph{15.4.}

{\tt  sublis} and {\tt nsublis} apply  the {\tt :key}  argument to the
nodes of the cons tree and not to the keys of the alist.


\subsection{Chapter 16: Hash Tables}

\paragraph{16.1.}

{\tt make-hash-table} has an additional keyword {\tt :initial-contents}
\begin{verbatim}
  (make-hash-table &key :test :initial-contents :size :rehash-size :rehash-threshold)
\end{verbatim}
\begin{sloppypar}
The {\tt  :initial-contents} argument  is   an alist that  is  used to
initialize the new  hash table.  The {\tt  :rehash-threshold} argument
is ignored.
\end{sloppypar}

For iteration through a hash table, a macro {\tt dohash}, analogous to
{\tt dolist}, can be used instead of {\tt maphash}:
\begin{verbatim}
  (dohash (key-var value-var hash-table-form [resultform])
          {declaration}* {tag|statement}*
  )
\end{verbatim}


\subsection{Chapter 17: Arrays}

\paragraph{17.1.}

{\tt array-rank-limit} is 65,536 on 16-bit processors, 4,294,967,296 on 32-bit
processors.

\noindent$\mbox{\tt array-dimension-limit}  = 2^{24} = 16777216$

\noindent$\mbox{\tt array-total-size-limit} = 2^{24} = 16777216$

\paragraph{17.6.}

An array to which another array is displaced should not be shrunk (using
{\tt adjust-array}) in such a way that the other array points into void space.
This is not checked at the time {\tt adjust-array} is called!


\subsection{Chapter 18: Strings}

\paragraph{18.2.}

String comparison  is based on   the function {\tt char<=}.  Therefore
diphtongs do not obey  the usual national  rules. Example: ${\tt  o} <
\mbox{\tt\oe} < {\tt z} < \mbox{\tt\oe}$.


\subsection{Chapter 19: Structures}

\paragraph{19.5.}

The {\tt :print-function} option should contain a lambda expression
\begin{verbatim}
  (lambda (structure stream depth) (declare (ignore depth)) ...)
\end{verbatim}
This lambda expression  names a function  whose task is  to output the
external representation of structure onto the stream. This may be done
by  outputting  text  onto the stream  using   {\tt  write-char}, {\tt
write-string},  {\tt write}, {\tt  prin1},  {\tt princ}, {\tt  print},
{\tt pprint}, {\tt format}  and the like.  The following rules must be
obeyed:

\begin{itemize}
\item The value of {\tt *print-escape*} must be respected.

 \item The value   of {\tt *print-pretty*} should  not  and cannot  be
  respected, since the pretty-print  mechanism is not accessible  from
  outside.

 \item    The   value  of {\tt    *print-circle*}     need  not to  be
  respected.  This  is managed by  the  system.  (But the print-circle
  mechanism handles only those  objects that are (direct or  indirect)
  components of structure.)

 \item The value  of {\tt *print-level*} is  respected by {\tt write},
  {\tt prin1}, {\tt princ},  {\tt  print}, {\tt pprint},  \verb+format
  ~a+,  \verb+format   ~s+, \verb+format   ~w+  and \verb+format  ~d+,
  \verb+~b+, \verb+~o+,  \verb+~x+,  \verb+~r+,  \verb+~f+, \verb+~e+,
  \verb+~g+, \verb+~$+   with not-numerical arguments.   Therefore the
  print-level  mechanism works automatically  if only  these functions
  are  used  for  outputting objects  and if  they   are not called on
  objects with nesting level${}>  1$. (The print-level  mechanism does
  not recognize how  many parentheses you have  output. It only counts
  how many times it was called recursively.)

 \item The value of {\tt *print-length*} must be respected, especially
  if you are outputting an arbitrary number of components.

 \item The value of {\tt *print-readably*} must be respected. Remember
  that  the values of {\tt  *print-escape*}, {\tt *print-level*}, {\tt
  *print-length*} don't matter if {\tt *print-readably*} is true.

\begin{sloppypar}
  The  value   of {\tt    *print-readably*}   is respected   by   {\tt
  print-unreadable-object},{\tt write}, {\tt prin1}, {\tt princ}, {\tt
  print},  {\tt pprint},     \verb+format   ~a+,  \verb+format    ~s+,
  \verb+format   ~w+  and  \verb+format   ~d+,  \verb+~b+,  \verb+~o+,
  \verb+~x+,   \verb+~r+,   \verb+~f+, \verb+~e+, \verb+~g+, \verb+~$+
  with not-numerical arguments.  Therefore {\tt *print-readably*} will
  be  respected automatically if  only   these functions are used  for
  outputting objects.
\end{sloppypar}

\begin{sloppypar}
 \item You need  not bother  about the  values  of {\tt *print-base*},
  {\tt *print-radix*},  {\tt *print-case*}, {\tt *print-gensym*}, {\tt
  *print-array*}, {\tt *print-closure*}, {\tt *print-rpars*}.
\end{sloppypar}
\end{itemize}

The  {\tt :inherit} option is  exactly like {\tt :include} except that
it doesn't create new accessors   for the  inherited slots. Use   this
option to avoid  the  problems that occur   when using the  same  {\tt
:conc-name} for the new and the inherited structure.


\subsection{Chapter 20: The Evaluator}

As in Scheme,  the  macro {\tt (the-environment)} returns  the current
lexical  environment. This works only  in interpreted  code and is not
compilable!

{\tt (eval-env  form   [env])} evaluates a  form in    a given lexical
environment, just if the  form had been  part of the program text that
environment came from.


\subsection{Chapter 21: Streams}

\paragraph{21.1.}

Input through {\tt *terminal-io*} uses the GNU readline library. Arrow
keys can be used to  move within the  input history. The {\tt Tab} key
completes   the   symbol's  name  that   is  being   typed.  See  {\tt
readline.dvi} for a complete description of the key bindings.  The GNU
readline library is not used if  standard input and standard output do
not both refer to the same terminal.

{\tt *terminal-io*} is not  the only stream that communicates directly
with the user:  during execution of the body  of a {\tt (with-keyboard
. body)} form,  {\tt *keyboard-input*} is   the stream that  reads the
keystrokes from  the keyboard.  It  returns every keystroke in detail,
as character with the following bits:

\begin{description}

\item[\tt  char-code]    the Ascii code for standard keys,

    for non-standard keys:  ${\rm F1} \rightarrow \verb+#\F1+$,\ldots,
    ${\rm         F10}\rightarrow        \verb+#\F10+$,          ${\rm
    F11}\rightarrow\verb+#\F11+$,  ${\rm F12}\rightarrow\verb+#\F12+$,
    ${\rm             Insert}\rightarrow\verb+#\Insert+$,        ${\rm
    Delete}\rightarrow\verb+#\Delete+$,                          ${\rm
    Center}\rightarrow\verb+#\Center+$,                          ${\rm
    Home}\rightarrow\verb+#\Home+$,                              ${\rm
    End}\rightarrow\verb+#\End+$,                                ${\rm
    PgUp}\rightarrow\verb+#\PgUp+$,                              ${\rm
    PgDn}\rightarrow\verb+#\PgDn+$,            ${\rm             Arrow
    keys}\rightarrow\verb+#\Up+$,   \verb+#\Down+,      \verb+#\Left+,
    \verb+#\Right+.

\item[\tt  control]      if pressed together with the Control key.
\end{description}

This keyboard input is not echoed on the  screen.  During execution of
a {\tt (with-keyboard . body)} form, no input from {\tt *terminal-io*}
or any synonymous stream should be requested.

\paragraph{21.2.}

The macro {\tt with-output-to-printer}
\begin{verbatim}
       (with-output-to-printer (var) {declaration}* {form}*)
\end{verbatim}
binds the variable var to an output stream that sends its output to the
printer.

\begin{sloppypar}
{\tt (make-pipe-input-stream  command)} returns  an input stream  that
will supply  the output  from   the execution of the  given  operating
system command.  See also {\tt (shell command)}.
\end{sloppypar}

{\tt (make-pipe-output-stream command)} returns  an output stream that
will pass its output as input to the  execution of the given operating
system command.  See also {\tt (shell command)}.

{\tt (make-pipe-io-stream command)}  returns three  values. The  first
value is a bidirectional   stream  that will simultaneously  pass  its
output as input to the execution of the given operating system command
and supply the output from this command as input. The second and third
value will be the input stream and the output  stream that make up the
I/O stream, respectively.  Note that they must be closed individually.

{\it  Warning}:     Improper   use  of this  function     can  lead to
deadlocks. You use  it  at your own   risk!  A deadlock occurs  if the
command and your program either both try  to read read from each other
at the same  time  or both  try  to write  to each other  at the  same
time. To  avoid deadlocks, it is recommended  that you fix  a protocol
between the command  and your program and  avoid any hidden buffering:
use {\tt read-char}, {\tt read-char-no-hang},  {\tt listen} instead of
{\tt read-line} and  {\tt read} on the  input side, and complete every
output  operation by  a  {\tt finish-output}. The  same  cautions must
apply to the called command as well.  See also {\tt (shell command)}.

Generic streams are user programmable streams. The programmer interface:

\begin{description}
 \item[\tt (make-generic-stream controller)] returns a generic stream.

\begin{sloppypar}
 \item[\tt (generic-stream-controller stream)]
     returns a private object to which generic stream methods dispatch.
     The typical usage is to retrieve the object originally provided by the
     user in {\tt make-generic-stream}.
\end{sloppypar}

 \item[\tt (generic-stream-p stream)] determines whether a stream is a
    generic stream, returning {\tt t} if it is, {\tt nil} otherwise.
\end{description}

In order to specify  the behaviour of  a generic stream, the user must
define  CLOS  methods  on the  following  CLOS generic  functions. The
function   {\tt generic-stream-xyz}  corresponds  to  the  Common Lisp
function {\tt xyz}.   They all take  a controller  and some number  of
arguments.

\begin{description}
 \item[\tt (generic-stream-read-char    controller)]\leavevmode

 \item[\tt (generic-stream-read-byte    controller)]
         These generic functions should return {\tt nil} at end of file.
         Takes one argument, the controller object.

 \item[\tt (generic-stream-listen       controller)]
         Returns -1 for EOF, 0 for character pending, and 1 for none.
         Takes one argument, the controller object.

\begin{sloppypar}
 \item[\tt (generic-stream-write-char   controller ch)]
         First argument is the controller object.
         Second argument is the character to be written.
\end{sloppypar}

\begin{sloppypar}
 \item[\tt (generic-stream-write-byte   controller by)]
         First argument is the controller object.
         Second argument is the integer to be written.
\end{sloppypar}

\begin{sloppypar}
 \item[\tt (generic-stream-write-string controller string start len)]
         Called with argument list (controller string start len),
         this function shall write:
\end{sloppypar}
\begin{verbatim}
           (subseq (the string string) start (+ start len))
\end{verbatim}
         First argument is the controller object.

 \item[\tt (generic-stream-clear-input   controller)]\leavevmode

 \item[\tt (generic-stream-clear-output  controller)]\leavevmode

 \item[\tt (generic-stream-finish-output controller)]\leavevmode

 \item[\tt (generic-stream-force-output  controller)]\leavevmode

 \item[\tt (generic-stream-close         controller)]

         Takes one argument, the controller object.
\end{description}


\paragraph{21.3.}

{\tt close} ignores its {\tt :abort} argument.


\subsection{Chapter 22: Input/Output}

\paragraph{22.1.2.}

A {\it reserved token}, i.e. a  token that has potential number syntax
but cannot  be interpreted as a  number, is interpreted as symbol when
being read. (CLtL1 p. 341)

When a token with package markers is read,  then (CLtL1 p. 343/344) no
checking is done whether the package part and  the symbol-name part do
not   have number syntax.  (What's the  purpose of this  check?) So we
consider tokens like  {\tt user::} or {\tt  :1} or {\tt lisp::4711} or
{\tt 21:3} as symbols.

\paragraph{22.1.3.}

The backquote read macro also works when nested. Example:
\begin{verbatim}
(eval ``(,#'(lambda () ',a) ,#'(lambda () ',b)))
\end{verbatim}
\noindent is quivalent to
\begin{verbatim}
(eval `(list #'(lambda () ',a) #'(lambda () ',b)))
\end{verbatim}
\noindent or
\begin{verbatim}
(eval (list 'list (list 'function (list 'lambda nil 
                                   (list 'quote a)))
       (list 'function (list 'lambda nil (list 'quote b)))
))
\end{verbatim}

Multiple backquote combinations like \verb+,,@+ or \verb+,@,@+ are not
implemented. Their use would be confusing anyway.

\paragraph{22.1.4.}

 \verb+#\+    allows   inputting   characters   of   arbitrary   code:
\verb+#\Code231+ yields the character {\tt (code-char 231.)}.

Additional read dispatch macros:
\begin{description}
\item[\tt \#y] is used to read compiled functions.
\begin{sloppypar}
\item[\tt \#"] is used to read pathnames:
     {\tt \#"test.lsp"} is the value of {\tt (pathname "test.lsp")}
\end{sloppypar}
\end{description}

\paragraph{22.1.5.}

Is it impossible to get the read macro function of a dispatch macro
character like \verb+#\#+ using {\tt get-macro-character}.

\begin{sloppypar}
The  CLtL2  place {\tt  readtable-case}  is  implemented. The possible
values   of {\tt (readtable-case readtable)}   are {\tt :upcase}, {\tt
:downcase} and {\tt :preserve}.
\end{sloppypar}

\paragraph{22.1.6.}

In  absence of  {\tt   SYS::write-float}, floating point  numbers  are
output in radix 2.

If {\tt *print-readably*}  is  true, {\tt *read-default-float-format*}
has no influence on the way floating point numbers are printed.

\begin{sloppypar}
Pathnames are written according  to the syntax  {\tt\#"namestring"} if
$\mbox{\tt   *print-escape*}   \neq    {\tt   nil}$.  If   $\mbox{\tt
*print-escape*} ={\tt nil}$, only the namestring is printed.
\end{sloppypar}

{\tt *print-case*}  controls the output not only  of symbols, but also
of characters and some \verb+#<...>+ objects.

{\tt *print-pretty*} is initially set to {\tt nil}.

{\tt *print-array*} is initially set to {\tt  t}.

\begin{sloppypar}
An additional variable {\tt *print-closure*} controls whether compiled
and interpreted functions (closures)  are output in detailed  form. If
$\mbox{\tt *print-closure*}\neq{\tt nil}$, compiled closures are output
in  {\tt\#y} syntax the  reader  understands. {\tt *print-closure*} is
initially set to {\tt nil}.


An additional  variable {\tt  *print-rpars*}  controls the  output  of
right   (closing)  parentheses.  If  $\mbox{\tt *print-rpars*}\neq{\tt
nil}$, closing parentheses which  don't fit onto the  same line as the
the corresponding  opening parenthesis  are  output just  below  their
corresponding    opening     parenthesis,  in    the    same   column.
{\tt*print-rpars*} is initially set to {\tt t}.
\end{sloppypar}

\paragraph{22.2.1.}

%\begin{sloppypar}
The    function  {\tt   read-char-sequence}    performs  multiple {\tt
read-char}  operations:  {\tt  (read-char-sequence  {\it sequence    stream}
[:start] [:end])} fills the subsequence  of {\it sequence} specified by {\tt
:start}  and  {\tt :end}  with    characters consecutively  read  from
{\it stream}. It returns the index of the first element of {\it sequence} that was
not updated (equal to end or less than end  if the stream reached its
end).
%\end{sloppypar}

This  function  is especially  efficient if sequence   is a string and
stream is  a file stream with element  type  {\tt string-char}, a pipe
stream or a string input stream.

\paragraph{22.2.2.}

%\begin{sloppypar}
The   function    {\tt  read-byte-sequence}  performs   multiple  {\tt
read-byte} operations: \\{\tt  (read-byte-sequence {\it sequence stream}
[:start] [:end])} fills the subsequence of {\it sequence} specified by
{\tt :start} and {\tt :end} with integers consecutively read from {\it
stream}. It returns the index  of the first  element of {\it sequence}
that was  not updated (equal to  end  or less than   end if the stream
reached its end).

This function  is especially efficient if  {\it sequence} is  a {\tt (vector
(unsigned-byte 8))} and {\it stream} is a file stream with element type {\tt
(unsigned-byte 8)} or a pipe stream.
%\end{sloppypar}

\paragraph{22.3.1.}

The functions {\tt  write} and {\tt write-to-string} have an additional keyword {\tt :closure}
that can be used to bind {\tt *print-closure*}.

The CLtL2 macro {\tt print-unreadable-object} is implemented.

The  function    {\tt   write-char-sequence}  performs  multiple  {\tt
write-char}   operations:   {\tt (write-char-sequence  {\it sequence stream}
[:start]  [:end])}  outputs the  characters    of the subsequence   of
{\it sequence} specified  by  {\tt :start}  and  {\tt :end}  to   {\it stream}.  It
returns {\it sequence}.

This function is especially efficient if sequence is a string and stream is
a file stream with element type {\tt string-char} or a pipe stream.

\paragraph{22.3.2.}

%\begin{sloppypar}
The  function   {\tt   write-byte-sequence} performs    multiple  {\tt
write-byte}   operations:\\{\tt(write-byte-sequence {\it sequence     stream}
[:start] [:end])} outputs the  integers of the subsequence of {\it sequence}
specified by   {\tt  :start} and {\tt  :end}  to   {\it stream}.  It returns
{\it sequence}.
%\end{sloppypar}

This function is  especially efficient if  sequence is  a {\tt (vector
(unsigned-byte 8))}  and stream  is a file   stream with element  type
({\tt unsigned-byte 8)} or a pipe stream.

\paragraph{22.3.3.}

The   {\tt format} option   \verb+~W+  is  analogous to  \verb+~A+ and
\verb+~S+,  but  avoids  binding of  {\tt*print-escape*}. \verb+(format
stream  "~W" object)+  is   equivalent to  {\tt (write object  :stream
stream)}.

 \verb+format  ~R+ and \verb+format  ~:R+ can  output only integers in
the range $|n| < 10^{66}$.  The output is in English, according to the
American conventions,  and  these  conventions  are  identical  to the
British conventions only in the range $|n| < 10^9$.

 \verb+format ~:@C+  does not output  the  character itself, only  the
instruction how to type the character.

\begin{sloppypar}
For     \verb+format ~E+    and  \verb+format ~G+,        the value of
{\tt*read-default-float-format*}     doesn't     matter             if
{\tt*print-readably*} is true.
\end{sloppypar}

 \verb+format ~T+ can determine the current column of any stream.


\subsection{Chapter 23: File System Interface}

\paragraph{23.1.}

For  most operations, pathnames  denoting files and pathnames denoting
directories   can   not  be    used interchangeably.      For example,
{\tt\#"foo/bar"}  denotes the file  {\tt  bar}  in the directory  {\tt
foo}, while {\tt\#"foo/bar/"} denotes   the subdirectory {\tt bar}  of
the  directory {\tt  foo}.   This  is   especially important for   the
functions {\tt directory}, {\tt  dir}, {\tt cd}, {\tt  make-dir}, {\tt
delete-dir}.

The minimum filename syntax that may be used portably is:
\begin{tabbing}
\tt"xxx.yy" \=\kill
\tt  "xxx"   \>    for a file with name {\tt xxx},\\
\tt  "xxx.yy" \>   for a file with name {\tt xxx} and type {\tt yy},\\
\tt  ".yy"    \>   for a pathname with type {\tt yy} and no name specified.
\end{tabbing}
Hereby {\tt xxx} denote 1 to 8 characters, and {\tt yy}  denote 1 to 3
characters, each  of    which  being  either  alphanumerical   or  the
underscore  \verb+#\_+.   Other   properties of pathname   syntax vary
between operating systems.

\paragraph{23.1.1.}

Pathname components:

\begin{description}
 \item[\tt host]          always {\tt nil}
 \item[\tt device]        always {\tt nil}

\begin{sloppypar}
 \item[\tt  directory]  {\tt  (startpoint    . subdirs)}  where   {\tt
    startpoint} is {\tt :relative} or  {\tt :absolute}; {\tt  subdirs}
    is {\tt ()} or {\tt (subdir . subdirs)}.
\end{sloppypar}

    {\tt  subdir} is  {\tt :wild}  (means   {\tt**}  or {\tt...},  all
    subdirectories) or subdir is a simple string, may contain wildcard
    characters {\tt?} and {\tt*}

 \item[\tt  name] {\tt nil}  or  simple  string, may contain  wildcard
    characters  {\tt?}   and    {\tt*} (may  also   be    specified as
    {\tt:wild}).

 \item[\tt type]  {\tt  nil} or  simple string,  may contain  wildcard
    characters {\tt?}     and  {\tt*}  (may   also be     specified as
    {\tt:wild}).

 \item[\tt version]       always {\tt nil} (may also be specified as {\tt :wild} or {\tt :newest}).
\end{description}

A {\sc unix} filename is  split into name  and  type according to  the
following rule:

\begin{itemize}
 \item  if there  is no  '{\tt.}' in the   filename, then  the {\tt name} is
everything, {\tt type} is {\tt nil};

 \item if there is a '{\tt.}', then {\tt name}  is the part before and
     {\tt type} the part after the last dot.
\end{itemize}

When a pathname  is to be fully specified  (no wildcards), that  means
that  no {\tt:wild} is allowed, no  wildcard characters are allowed in
the strings, neither {\tt name} is allowed to be {\tt nil}.

\smallskip\noindent\begin{tabular}{lr}
External notation: &  {\tt server:sub1.typ/sub2.typ/name.typ}\\
using defaults:   &{\tt       sub1.typ/sub2.typ/name.typ}\\
or                &      {\tt                    name.typ}\\
or                   &     {\tt  sub1.typ/**/sub3.typ/x*.lsp}\\
or similar.
\end{tabular}

The wildcard characters:  {\tt*} matches  any sequence of  characters,
{\tt?} matches any one character.

Due to the {\tt  name}/{\tt type} splitting  rule, there are pathnames
that can't result from {\tt parse-namestring}. To get a pathname whose
type contains a dot  or whose name  contains  a dot and whose  type is
{\tt  nil},  {\tt   make-pathname}  must   be   used.  Example:   {\tt
(make-pathname :name ".profile")}.

\paragraph{23.1.2.}

\begin{sloppypar}
External notation of pathnames   (cf. {\tt parse-namestring}  and {\tt
namestring}),   of course  without   spaces,  {\tt[}, {\tt]}, \verb+{+,
\verb+}+:
\end{sloppypar}

\begin{tabbing}
\tt [ name [. type] ] \=\kill
\tt[ / ]  \>              {\tt /} denotes absolute pathnames\\
\verb+{ name / }+   \>         each one a subdirectory\\
\tt [ name [. type] ]   \>  filename with type (extension)
\end{tabbing}

{\tt name} and  {\tt type} may be  character  sequences of any  length
(consisting of printing ASCII characters, except {\tt/}).

\paragraph{23.2.}

The file streams returned by {\tt open} are buffered for regular files and
unbuffered for special files.

\paragraph{23.3.}

{\tt file-author} always returns {\tt nil}.

\paragraph{23.4.}

{\tt load} has two additional keywords {\tt :echo} and {\tt:compiling}.
\begin{verbatim}
(load filename &key :verbose :print :echo :if-does-not-exist :compiling)
\end{verbatim}
\begin{description}
 \item[\tt:verbose t] causes {\tt load} to emit a short message that a
             file     is  being     loaded.        The   default    is
             {\tt*load-verbose*}, which is initially {\tt t}.

\begin{sloppypar}
 \item[\tt:print t] causes {\tt load} to print the value of each form.
             The default is  {\tt  *load-print*}, which is   initially
             {\tt nil}.
\end{sloppypar}

 \item[\tt:echo t] causes the input from the file to be echoed to {\tt
             *standard-output*} (normally to the screen). Should there
             be an error in the file, you  can see at one glance where
             it is.    The  default   is  {\tt*load-echo*},  which  is
             initially {\tt nil}.

 \item[\tt:compiling t] causes  each form read  to be  compiled on the
             fly.  The  compiled code is  executed at  once  and ---in
             contrast to {\tt compile-file}--- not written to a file.
\end{description}

The CLtL2 variables {\tt *load-pathname*} and {\tt*load-truename*} are
implemented.

The variable {\tt*load-paths*}  contains  a list of  directories where
program files are searched ---additionally to the specified or current
directory--- by {\tt load}, {\tt require}, {\tt compile-file}.

\paragraph{23.5.}

{\tt (directory [pathname [:full] [:circle]])} can run in two modes:
\begin{itemize}
 \item If pathname contains no  {\tt name} or  {\tt type} component, a
  list of all matching directories is produced.

 \item Otherwise a list of all matching files is returned. If the {\tt
  :full} argument  is   not   {\tt nil}, this    contains   additional
  information: for each matching file you get  a list of at least four
  elements          {\tt            (file-pathname       file-truename
  file-write-date-as-decoded-time file-length)}.
\end{itemize}

If the {\tt :circle}  argument is not {\tt  nil}, the  function avoids
endless loops that may result from symbolic links.

{\tt (dir   [pathname])}  is like {\tt   directory},  but displays the
pathnames instead of returning them. {\tt (dir)} shows the contents of
the current directory.

{\tt (cd  [pathname])}   manages  the current directory.     {\tt  (cd
pathname)} sets it, {\tt(cd)} returns it.

{\tt  (default-directory)}   is equivalent  to  {\tt(cd)},  {\tt (setf
(default-directory) pathname)} is equivalent to {\tt(cd pathname)}.

{\tt(make-dir directory-pathname)} creates a new subdirectory.

{\tt(delete-dir directory-pathname)} removes an (empty) subdirectory.

{\tt(execute    programfile  arg1  arg2    ...)} executes  an external
program. Its name  is {\tt programfile}.  It is given the strings {\tt
arg1}, {\tt arg2},\ldots\ as arguments.

{\tt(shell    [command])}  calls    the  operating   system's   shell.
{\tt(shell)} calls the shell for interactive use. {\tt(shell command)}
calls the shell only for execution of the one given command.

The functions {\tt run-shell-command} and {\tt run-program} are a general interface to
{\tt shell} and the above:
\begin{verbatim}
  (run-shell-command command [:input] [:output] [:if-output-exists])
\end{verbatim}
\noindent    runs a shell command.

\begin{verbatim}
  (run-program program [:arguments] [:input] [:output] [:if-output-exists])
\end{verbatim}
\noindent    runs an external program.

\begin{description}
 \item[\tt command]     specifies the shell command.

 \item[\tt program ] specifies the program.  The directories listed in
                         the {\tt path}  environment veriable  will be
                         searched for it.

 \item[\tt  :arguments]  specifies a list of arguments (strings) that are
                         given to the program.

 \item[\tt :input] specifies where the   program's input  is  to  come
                         from:   either  {\tt:terminal}  (the standard
                         input) or  {\tt:stream} (a  Lisp stream to be
                         created)  or  a  pathname (an input  file) or
                         {\tt nil} (no input at all).

 \item[\tt :output] specifies where the program's output is to be sent
                         to:   either {\tt:terminal}   (the   standard
                         output) or {\tt:stream}  (a Lisp stream to be
                         created) or a  pathname (an  output file)  or
                         {\tt nil} (ignore the output).

 \item[\tt :if-output-exists] specifies what to do if the {\tt:output}
                         file already exists.  The possible values are
                         {\tt:overwrite}, {\tt:append},   {\tt:error},
                         with the same meaning as for {\tt open}.
\end{description}

If {\tt :stream}  was specified for {\tt  :input} or  {\tt :output}, a
Lisp  stream is  returned.    If  {\tt  :stream}  was   specified  for
{\tt:input} and {\tt:output}, three Lisp  streams are returned, as for
the function {\tt make-pipe-io-stream}. This  use of {\tt run-program}
can cause deadlocks, see {\tt make-pipe-io-stream}.


\subsection{Chapter 24: Errors}

\paragraph{24.1.}

When  an error occurred,  you are  in  a break loop. You  can evaluate
forms as usual. The {\tt help}  command (or help key  if there is one)
lists the available debugging commands.


\subsection{Chapter 25: Miscellaneous Features}

\paragraph{25.1.}

\begin{sloppypar}
The compiler  can be called not  only by the functions  {\tt compile},
{\tt compile-file} and {\tt disassemble}, also by the declaration {\tt
(compile)}.
\end{sloppypar}

\medskip\noindent{\tt(compile-file {\it input-file} [:output-file] [:listing]}\\
\verb+                         [:warnings] [:verbose] [:print])+

\medskip
\noindent compiles a file to bytecode.

\begin{description}
\item[\it input-file]               should be a pathname/string/symbol.

 \item[\tt :output-file] should  be   {\tt nil}   or   {\tt t}   or  a
                              pathname/string/symbol        or      an
                              output-stream. The default is {\tt t}.

 \item[\tt :listing] should be {\tt nil}   or      {\tt  t}  or      a
                              pathname/string/symbol       or       an
                              output-stream. The default is {\tt nil}.

\item[\tt  :warnings]        specifies whether warnings should also appear
                              on the screen.


\item[\tt :verbose]         specifies whether error messages should also
                              appear on the screen.

\item[\tt :print]           specifies whether an indication which forms are
                              being compiled should appear on the screen.
\end{description}

The     variables    {\tt*compile-warnings*},  {\tt*compile-verbose*},\\
{\tt*compile-print*}    provide   defaults  for   the  {\tt:warnings},
{\tt:verbose}, {\tt:print} keyword arguments, respectively.


The     CLtL2   variables     {\tt   *compile-file-pathname*}      and\\
{\tt*compile-file-truename*} are implemented.

The  CLtL2 special form {\tt   load-time-value} is implemented. \\{\tt
(load-time-value   {\it form})} is  like  {\tt  (quote \#,{\it form})}
except that the former can be generated by macros.

\begin{sloppypar}
The  CLtL2  function {\tt  function-lambda-expression} is implemented.
{\tt (function-lambda-expression {\it function})} returns information  about
the source   of an  interpreted  {\it function}: lambda-expression,  lexical
environment, name.
\end{sloppypar}

\paragraph{25.2.}

No on-line documentation is available for the system functions (yet).

\paragraph{25.3.}

{\tt (trace {\it fun} ...)} makes the functions {\it fun},\ldots\ traced. Syntax of fun:

Either a symbol:
       {\tt symbol}\\
or a list of a symbol and some keywords and arguments (which must come in
pairs!):

{\tt\begin{tabbing}
mm\=[:post-break-if form] \=\kill
  (symbol\\
\>[:suppress-if form] \>  ;\rm\ no trace output as long as form is true\\
\>[:step-if form]      \> ;\rm\ invokes the stepper as soon as form is true\\
\>[:pre form]          \> ;\rm\ evaluates form before calling the function\\
\>[:post form]        \> ;\rm\ evaluates form after return from the function\\
\>[:pre-break-if form] \> ;\rm\ goes into the break loop before calling the function if form is true\\
\>[:post-break-if form]\> ;\rm\ goes into the break loop after return from the function if form is true\\
\>[:pre-print form]    \> ;\rm\ prints the values of form before calling the function\\
\>[:post-print form]    \>;\rm\ prints the values of form after return from the function\\
\>[:print form]         \>;\rm\ prints the values of form both before calling and after return \\
) \>                      \>;\rm\ from the function\\

    \end{tabbing}}

In all these forms you can access
\begin{tabbing}
the function/macro call as form \=\kill
  the function itself            \>   as {\tt *trace-function*},\\
  the arguments to the function  \>   as {\tt*trace-args*},\\
  the function/macro call as form \>  as {\tt*trace-form*},
\end{tabbing}

\noindent and after return from the function
  the  list of   return      values from   the function   call      as
{\tt*trace-values*},  and  you can  leave     the function call   with
specified values by using {\tt return}.

{\tt    trace}  and {\tt untrace}  are    also applicable to functions
{\tt(setf {\it symbol})} and to macros, but not to locally defined functions
and macros.

The function {\tt inspect} is not implemented.

The   function {\tt room}  can only  be  called  without arguments. It
returns two   values: the number of bytes   currently occupied by Lisp
objects, and the number of bytes that can be allocated before the next
regular garbage collection occurs.

The function  {\tt ed}  calls   the external editor specified  by  the
variable {\tt *editor*} (see {\tt config.lsp}).

If using the optional package {\tt editor}: {\tt ed} behaves like this
  only if  the variable {\tt *use-ed*} is  {\tt  nil}.  Otherwise {\tt
  ed} uses an Emacs-like screen editor with multiple windows.

The function {\tt uncompile} does the converse of {\tt compile}:
{\tt (uncompile {\it function-name})}
reverts an interpreted function that has been entered or loaded in the same
session and then compiled back to its interpreted form.

\paragraph{25.4.1.}

The timezone in a decoded time must not necessarily be an integer, but (as
float or rational number) it should be a multiple of $1/4$.

\noindent$\mbox{\tt internal-time-units-per-second} = 1000000$.

\paragraph{25.4.2.}

The functions   {\tt short-site-name}, {\tt  long-site-name} should be
defined in a site-specific {\tt config.lsp} file.

The variable {\tt*features*} initially contains the symbols

\begin{tabbing}
\tt interpreter \=\kill
\tt clisp          \>  ; this implementation\\
\tt common-lisp\\
\tt cltl1\\
\tt interpreter\\
\tt compiler\\
\tt loop\\
\tt clos\\
\tt atari         \>    ; if hardware is Atari ST/TT and operating system is {\sc tos}\\
\tt amiga        \>     ; if hardware is Amiga and operating systemis= Exec/AmigaDOS\\
\tt dos           \>    ; if hardware is PC (clone)  and operating system {\sc  dos}\\
\tt os/2          \>    ; if hardware isPC (clone)  and operating system is OS/2\\
\tt pc386          \>   ; if hardware is PC (clone) with a 386/486\\
\tt unix           \>   ; if operating system is {\sc unix}, in this case the\\
\>                 ;                               hardware is irrelevant.
\end{tabbing}

\subsection{Chapter 26: Loop}

The CLtL2 macros {\tt loop} and {\tt loop-finish} are implemented.


\subsection{Chapter 28: Common Lisp Object System}

To use CLOS, do {\tt (use-package "CLOS")}.


The  functions 

\begin{quote} \begin{flushleft}
  {\tt     slot-value}, {\tt     slot-boundp},  {\tt
  slot-makunbound}, {\tt slot-exists-p},  {\tt find-class}, {\tt (setf
  find-class)},      {\tt class-of},   {\tt  call-next-method},   {\tt
  next-method-p}, {\tt  class-name},  {\tt  (setf  class-name)},  {\tt
  no-applicable-method}, {\tt no-next-method}, {\tt find-method}, {\tt
  add-method}, {\tt remove-method}, {\tt  compute-applicable-methods},
  {\tt   method-qualifiers},     {\tt   function-keywords},       {\tt
  slot-missing},   {\tt    slot-unbound}, {\tt   print-object},   {\tt
  describe-object},  {\tt make-instance},  {\tt  initialize-instance},
  {\tt reinitialize-instance}, {\tt shared-initialize},
	      \end{flushleft}
\end{quote}


 \noindent the  macros
 \begin{quote}\begin{flushleft}
  {\tt  with-slots}, {\tt  with-accessors},  {\tt
  defclass},      {\tt    defmethod},     {\tt  defgeneric},      {\tt
  generic-function}, {\tt generic-flet}, {\tt generic-labels},
	      \end{flushleft}
 \end{quote}

 \noindent the  classes
\begin{quote}\begin{flushleft}
  {\tt  standard-class},  {\tt structure-class},
  {\tt  built-in-class},     {\tt          standard-object},      {\tt
  standard-generic-function}, {\tt standard-method} and all predefined
  classes,
	     \end{flushleft}
\end{quote}

\noindent and the method combination
  {\tt standard} are implemented.

\medskip
\noindent Deviations from CLtL2 chapter 28:

{\tt defclass}: it {\it is} required that  the superclasses of a class
be defined before the {\tt defclass} form for the class is evaluated.

The {\tt real} type is added to the predefined classes listed in table 28-1.

Only {\tt standard} method combination is implemented.

When {\tt call-next-method} is  called  with arguments, the rule  that
the ordered   set of applicable  methods must  be the same  as for the
original arguments is not enforced by the implementation.

\begin{sloppypar}
{\tt call-next-method} and  {\tt next-method-p} are  local macros, not
local functions.  Use  {\tt\#'(lambda ()  (call-next-method))} instead
of {\tt\#'call-next-method} if you really need it as a function.

There is a generic function {\tt no-primary-method} (analogous to {\tt
no-applicable-method}) which is called when  a generic function of the
class {\tt standard-generic-function} is invoked and no primary method
on that generic function is applicable.
\end{sloppypar}

{\tt generic-flet} and {\tt generic-labels} are implemented as macros,
not as special forms.

The function {\tt ensure-generic-function} is not implemented.

{\tt add-method} can put methods into other generic functions than the one the method
came from.

{\tt  print-object}  and  {\tt describe-object}  are   only called  on
objects of type {\tt standard-object}.

{\tt describe-object} should  not call  {\tt describe} recursively  as
this would produce more  information than is likely  to be useful to a
human reader.

{\tt documentation} still has the CLtL1 implementation.

%\begin{sloppypar}
User-defined method combination   is  not   supported.   The  sections
28.1.7.3., 28.1.7.4., the macros {\tt define\-method-combination}, {\tt
call-method}   and the   functions  {\tt  invalid-method-error},  {\tt
method-combination-error},  {\tt    method-qualifiers}     are     not
implemented.
%\end{sloppypar}

The special form {\tt with-added-methods} is not implemented.

%\begin{sloppypar}
Redefining  classes   is    not  supported.  The sections    28.1.10.,
28.1.10.1., 28.1.10.2., 28.1.10.3., 28.1.10.4.  and the  function {\tt
update-instance-for-redefined-class} are not implemented.
%\end{sloppypar}

Changing the class of a given instance is not supported.  The sections
28.1.11., 28.1.11.1.,  28.1.11.2.,  28.1.11.3. and the  functions {\tt
change-class},  {\tt      update-instance-for-different-class},   {\tt
make-instances\-obsolete} are not implemented.


\subsection{Chapter 29: Conditions}

\paragraph{29.4.1.}

\begin{sloppypar}
The default condition type for conditions created by {\tt signal} is
{\tt simple-condition}, not {\tt simple-error}.
\end{sloppypar}

\paragraph{29.4.7.}

In {\tt restart-case} clauses the argument list  can also be specified
after the {\tt  keyword}/{\tt value} pairs   instead of  before them.  The  syntax
therefore is \verb+(restart-case form {restart-clause}*)+ with:

\begin{tabbing}
\tt  restart-clause${}::={}$\=\tt(restart-name arglist {keyword value}* {form}*)\\
       \>${}|{}$\tt (restart-name {keyword value}* arglist {form}*)
\end{tabbing}

The macro {\tt with-restarts} is like {\tt restart-case}, except that the forms are
specified after the restart clauses instead of before them, and the
restarts created are not implicitly associated to any condition.

\begin{sloppypar}
{\tt (with-restarts   ({restart-clause}*)   {form}*)}   is   therefore
equivalent to {\tt (restart-case (progn {form}*) {restart-clause}*)}.
\end{sloppypar}

\paragraph{29.4.8.}

{\tt  compute-restarts} and {\tt  find-restart} behave as specified in
dpANS: if  the  optional condition  argument is  not  {\tt nil},  only
restarts associated with that condition  and restarts associated to no
condition at all are considered.  Therefore  the effect of associating
a restart to a  condition is not to activate  it, but to hide  it from
other conditions. This makes the syntax dependent implicit association
performed by {\tt restart-case} nearly obsolete.

\paragraph{29.4.9.}

\begin{sloppypar}
The  default  condition type for  conditions  created by {\tt warn} is
{\tt simple-warning}, not {\tt simple-error}.
\end{sloppypar}


\subsection{Chapter 90: Platform independent Extensions}

\paragraph{90.1. Saving an Image}\leavevmode

\begin{sloppypar}
The function  {\tt (saveinitmem [filename [:quiet] [:init-function]])}
saves the running CLISP's  memory to a file.  The filename defaults to
{\tt lispinit.mem}.  If  the {\tt :quiet} argument  is not {\tt  nil},
the startup banner  and the good-bye message  will  be suppressed. The
{\tt   :init-function}  argument  specifies a function    that will be
executed at startup of the saved image.
\end{sloppypar}

\paragraph{90.2. Quitting Lisp}\leavevmode

The functions {\tt (exit  [errorp])}, {\tt  (quit [errorp])} and  {\tt
(bye [errorp])} ---all synonymous--- terminate CLISP. If errorp is not
{\tt  nil}, CLISP aborts  with  error status,  i.e. the environment is
informed that the CLISP session didn't succeed.

\paragraph{90.3. The Language}\leavevmode

\begin{sloppypar}
The language CLISP  uses to  communicate  with the user  can be either
English  or Deutsch (i.e.  German) or Fran\c   cais (i.e. French). The
macros {\tt english},    {\tt   deutsch}, {\tt   francais}   and  {\tt
language-case} produce  code   that  depends on the    language:  {\tt
(english  english-form deutsch    deutsch-form francais francais-form)}
---and   all permutations     of  this---  evaluates    all of    {\tt
english-form},   {\tt  deutsch-form},    {\tt francais-form}   in   no
particular  order and returns  the  evaluation result corresponding to
the user language.

{\tt (language-case {clause}*)} executes the clause (analogous to {\tt
case}) that corresponds to the user  language.  The language itself is
the value of {\tt      (english 'english deutsch   'deutsch   francais
'francais)}.
\end{sloppypar}


\subsection{Chapter 91: The Debugger and Stepper}

The    debugger   may    be  invoked  through     the  functions  {\tt
invoke-debugger},   {\tt   break},  {\tt  signal},   {\tt error}, {\tt
cerror}, {\tt warn}.  The stepper  is invoked  through the  macro {\tt
step}.  Debugger and stepper execute subordinate {\tt read-eval-print}
loops (called {\it break loops}) which are analogous  to the main {\tt
read-eval-print} loop except for the  prompt and the set of  available
commands. Commands must be typed literally, without surrounding quotes
or white space.

Commands common to the main loop, the debugger and the stepper:
\begin{tabbing}
\tt Backtrace-1 \=\kill
\tt  Help   \>    prints a list of available commands.
\end{tabbing}

Commands common to the debugger and the stepper:
 \begin{tabbing}
\tt Backtrace-1 \=\kill
\tt  Abort \>    and\\
\tt  Unwind  \>   abort to the next most recent {\tt read-eval-print} loop.
 \end{tabbing}

The stack is organized into  frames and other stack elements.  Usually
every invocation of an interpreted function and every evaluation of an
interpreted form corresponds to one stack frame. Special forms such as
{\tt let}, {\tt let*},   {\tt unwind-protect} and {\tt catch}  produce
special kinds of stack frames.

In a break loop there is a current stack frame, which is initially the
most  recent stack frame but can  be moved using the debugger commands
{\tt Up} and {\tt Down}.

Evaluation of forms in a break loop occurs in the lexical environment of the
current stack frame but in the dynamic environment of the debugger's caller.
This means that to inspect or modify a lexical variable all you have to do
is to move to the current stack frame just below the frame that corresponds
to the form or the function call that binds that variable.

There is a current {\it stack mode} which defines in how much detail the stack
is shown by the stack related debugger commands.

Commands common to the debugger and the stepper:
\begin{tabbing}
\tt Backtrace-1 \=\kill
\tt Mode-1\> sets the current mode to {\tt 1:} all the stack elements are considered.  This mode is fine for \\
  \>         debugging compiled functions.\\
\tt Mode-2\> sets the current mode to {\tt2:} all the frames are considered.\\
\tt Mode-3\>  sets the current mode to {\tt3:} only lexical frames (frames that correspond to special forms that \\
      \>   modify the lexical environment)      are considered.\\
\tt Mode-4\>   sets the current mode to {\tt4:} (the default) only {\tt eval} and {\tt apply} frames are considered. Every \\
  \>            evaluation of a form in the interpreter corresponds to an {\tt eval} frame.\\
\tt Mode-5\>   sets the current mode to {\tt5:} only {\tt apply} frames are considered.  Every invocation of an\\
     \>      interpreted function corresponds to one   {\tt apply} frame.\\
\tt Where\>       shows the current stack frame.\\
\tt Up\>          goes up one frame, i.e. to the caller if in {\tt mode-5}\\
\tt Down\>        does down one frame, i.e. to the callee if in {\tt mode-5}\\
\tt Top\>   goes to top frame, i.e. to the top-level form if in {\tt mode-4}\\
\tt Bottom\>   goes to bottom (most recent) frame, i.e. most probably to the form or function that caused \\
      \>       the debugger to be entered.\\
\tt Backtrace\>lists the stack in current mode, bottom frame first, top frame  last.\\
\tt Backtrace-1\> lists the stack in {\tt mode-1}.\\
\tt Backtrace-2\> lists the stack in {\tt mode-2}.\\
\tt Backtrace-3\> lists the stack in {\tt mode-3}.\\
\tt Backtrace-4\> lists the stack in {\tt mode-4}.\\
\tt Backtrace-5\> lists the stack in {\tt mode-5}.
\end{tabbing}

If the current stack frame is an {\tt eval} or  {\tt apply} frame, the
following commands are available as well:
\begin{tabbing}
\tt Backtrace-1 \=\kill
\tt Break+\> sets a breakpoint in the current frame. When the corresponding  form or function will be left,\\
   \>     the debugger will be entered  again, with the variable {\tt*trace-values*} containing a list of\\
   \>     its values.\\
\tt Break-\> removes a breakpoint from the current frame.\\
\tt Redo\>   re-evaluates the corresponding form or function call. This command can be used to restart \\
   \>       parts of a computation without     aborting it entirely.\\
\tt Return\> leaves the current frame. You will be prompted for the     return values.
\end{tabbing}

Commands specific to the debugger:
\begin{tabbing}
\tt Backtrace-1 \=\kill
\tt Continue\>    continues evaluation of the program.
\end{tabbing}

Commands specific to the stepper:
\begin{tabbing}
\tt Backtrace-1 \=\kill
\tt Step\>     step into a form: evaluate this form in single step mode\\
\tt Next \>       step over a form: evaluate this form at once\\
\tt Over \>  step over this level: evaluate at once up to the next return\\
\tt Continue\>    switch off single step mode, continue evaluation
\end{tabbing}

The stepper is usually used like this:  if some form returns a strange
value  or results  in an error,   call {\tt (step  form)} and navigate
using the commands {\tt Step} and {\tt  Next} until you reach the form
you regard as  responsible. If  you are  too fast (execute  {\tt Next}
once and get the error), there is no way back; you have to restart the
entire stepper session.  If you are  too slow (stepped into a function
or a form which certainly  is OK), a couple  of {\tt Next} commands or
one {\tt Over} command will help.


\subsection{Chapter 99: Platform specific Extensions}

\paragraph{99.2. Random Screen Access}\leavevmode

\begin{description}
 \item[{\tt (screen:make-window)}] returns a {\it  window stream}. As long  as
  this   stream is open, the  terminal  is in cbreak/noecho mode. {\tt
  *terminal-io*} shouldn't be   used for input  or  output during this
  time. (Use {\tt with-keyboard} and {\tt*keyboard-input*} instead.)

%\begin{sloppypar}
 \item[{\tt  (screen:with-window  . body)}]  binds {\tt  screen:*window*} to a
  window stream and  executes body.  The stream  is guaranteed  to  be
  closed when  the  body  is     left. During its   execution,    {\tt
  *terminal-io*} shouldn't be used, as above.
%\end{sloppypar}

 \item[{\tt(screen:window-size window-stream)}]
  returns the window's size, as two values:
  {\tt height} (${}= {\tt Ymax}+1$) and {\tt width} (${}= {\tt xmax}+1$).

 \item[{\tt(screen:window-cursor-position window-stream)}]
  returns the position of the cursor in the window, as two values:
  $0\le{\tt line}\le{\tt Ymax}$ (0 means top), $0\le{\tt column}\le {\tt Xmax}$(0 means left margin).

\begin{sloppypar}
 \item[{\tt(screen:set-window-cursor-position window-stream line column)}]
  sets the position of the cursor in the window.


 \item[{\tt(screen:clear-window window-stream)}]
  clears the window's contents and puts the cursor in the upper left corner.

 \item[{\tt(screen:clear-window-to-eot window-stream)}]
  clears the window's contents from the cursor position to the end of window.

 \item[{\tt(screen:clear-window-to-eol window-stream)}]
  clears the window's contents from the cursor position to the end of line.

 \item[{\tt(screen:delete-window-line window-stream)}]
  removes the cursor's line, moves the lines below it up by one line and
  clears the window's last line.
\end{sloppypar}

 \item[{\tt(screen:insert-window-line window-stream)}]
  inserts a line at the cursor's line, moving the lines below it down by
  one line.

 \item[{\tt(screen:highlight-on window-stream)}]
  switches highlighted output on.

 \item[{\tt(screen:highlight-off window-stream)}]
  switches highlighted output off.

 \item[{\tt  (screen:window-cursor-on window-stream)}] makes the cursor
  visible, a cursor block in most implementations.

 \item[{\tt (screen:window-cursor-OFF window-stream)}]
  makes the cursor invisible, in implementations where this is possible.
\end{description}


