\input texinfo @c -*-texinfo-*-
@setfilename ../../info/cl.info
@settitle Common Lisp Extensions
-@documentencoding UTF-8
+@include docstyle.texi
@include emacsver.texi
@copying
This file documents the GNU Emacs Common Lisp emulation package.
-Copyright @copyright{} 1993, 2001--2014 Free Software Foundation, Inc.
+Copyright @copyright{} 1993, 2001--2016 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
called @var{name}; @pxref{Blocks and Exits}.
@end defmac
+@defmac cl-iter-defun name arglist body@dots{}
+This form is identical to the regular @code{iter-defun} form, except
+that @var{arglist} is allowed to be a full Common Lisp argument
+list. Also, the function body is enclosed in an implicit block
+called @var{name}; @pxref{Blocks and Exits}.
+@end defmac
+
@defmac cl-defsubst name arglist body@dots{}
This is just like @code{cl-defun}, except that the function that
is defined is automatically proclaimed @code{inline}, i.e.,
the compilation itself:
@example
-foo1 foo3 foo5 foo7 ; `compile'
+foo1 foo3 foo5 foo7 ; 'compile'
@end example
When @file{foo.elc} is loaded, these variables will be set:
@example
-foo2 foo3 foo6 foo7 ; `load'
+foo2 foo3 foo6 foo7 ; 'load'
@end example
And if @file{foo.el} is loaded uncompiled, these variables will
be set:
@example
-foo4 foo5 foo6 foo7 ; `eval'
+foo4 foo5 foo6 foo7 ; 'eval'
@end example
If these seven @code{cl-eval-when}s had been, say, inside a @code{defun},
The generalized variable @code{buffer-substring}, listed above,
also works in this way by replacing a portion of the current buffer.
-@c FIXME? Also `eq'? (see cl-lib.el)
+@c FIXME? Also 'eq'? (see cl-lib.el)
@c Currently commented out in cl.el.
@ignore
This clause stops the loop when the specified form is non-@code{nil};
in this case, it returns that non-@code{nil} value. If all the
values were @code{nil}, the loop returns @code{nil}.
+
+@item iter-by @var{iterator}
+This clause iterates over the values from the specified form, an
+iterator object. See (@pxref{Generators,,,elisp,GNU Emacs Lisp
+Reference Manual}).
@end table
@node Accumulation Clauses
code.
(Internally, the variable @code{cl--gensym-counter} holds the counter
-used to generate names. It is incremented after each use. In Common
-Lisp this is initialized with 0, but this package initializes it with
-a random time-dependent value to avoid trouble when two files that
-each used @code{cl-gensym} in their compilation are loaded together.
-Uninterned symbols become interned when the compiler writes them out
-to a file and the Emacs loader loads them, so their names have to be
-treated a bit more carefully than in Common Lisp where uninterned
-symbols remain uninterned after loading.)
+used to generate names. It is initialized with zero and incremented
+after each use.)
@end defun
@defun cl-gentemp &optional x
error if the argument is not an integer.
@end defun
+@defun cl-digit-char-p char radix
+Test if @var{char} is a digit in the specified @var{radix} (default is
+10). If it is, return the numerical value of digit @var{char} in
+@var{radix}.
+@end defun
+
@node Numerical Functions
@section Numerical Functions
of @code{cl-truncate}.
@end defun
+@defun cl-parse-integer string &key start end radix junk-allowed
+This function implements the Common Lisp @code{parse-integer}
+function. It parses an integer in the specified @var{radix} from the
+substring of @var{string} between @var{start} and @var{end}. Any
+leading and trailing whitespace chars are ignored. The function
+signals an error if the substring between @var{start} and @var{end}
+cannot be parsed as an integer, unless @var{junk-allowed} is
+non-@code{nil}.
+@end defun
+
@node Random Numbers
@section Random Numbers
advisory in Emacs Lisp, do not rigorously obey the scoping rules
set down in Steele's book.
-The variable @code{cl--gensym-counter} starts out with a pseudo-random
-value rather than with zero. This is to cope with the fact that
-generated symbols become interned when they are written to and
-loaded back from a file.
+The variable @code{cl--gensym-counter} starts out with zero.
The @code{cl-defstruct} facility is compatible, except that structures
are of type @code{:type vector :named} by default rather than some
implement a Common Lisp-style @code{make-list}.
@item
-A few more notable Common Lisp features not included in this
-package: @code{compiler-let}, @code{tagbody}, @code{prog},
-@code{ldb/dpb}, @code{parse-integer}, @code{cerror}.
+A few more notable Common Lisp features not included in this package:
+@code{compiler-let}, @code{prog}, @code{ldb/dpb}, @code{cerror}.
@item
Recursion. While recursion works in Emacs Lisp just like it
For those cases where the dynamic scoping of @code{flet} is desired,
@code{cl-flet} is clearly not a substitute. The most direct replacement would
be instead to use @code{cl-letf} to temporarily rebind @code{(symbol-function
-'@var{fun})}. But in most cases, a better substitute is to use an advice, such
+'@var{fun})}. But in most cases, a better substitute is to use advice, such
as:
@example
@c Bug#411.
Note that many primitives (e.g., @code{+}) have special byte-compile handling.
-Attempts to redefine such functions using @code{flet}, @code{cl-letf}, or an
+Attempts to redefine such functions using @code{flet}, @code{cl-letf}, or
advice will fail when byte-compiled.
@c Or cl-flet.
@c In such cases, use @code{labels} instead.