aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorGlenn Morris2012-11-03 12:14:22 -0700
committerGlenn Morris2012-11-03 12:14:22 -0700
commitf58542e1510319921d1745e0ad647ed42b1157f2 (patch)
tree7dce084101c1b16c1249eda33e03cbea15d08abc /doc/misc
parent7ccfb720b477df05042729e0e300bae5922f5120 (diff)
parent92246540b0616afd90600aabbac964f5a0b544ca (diff)
downloademacs-f58542e1510319921d1745e0ad647ed42b1157f2.tar.gz
emacs-f58542e1510319921d1745e0ad647ed42b1157f2.zip
Merge from emacs-24; up to 2012-11-03T05:11:34Z!dmantipov@yandex.ru
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/ChangeLog11
-rw-r--r--doc/misc/cl.texi358
2 files changed, 186 insertions, 183 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 768a846bd1a..0a32fd82044 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,14 @@
12012-11-03 Glenn Morris <rgm@gnu.org>
2
3 * cl.texi: Further general copyedits.
4 (List Functions): Remove copy-tree, standard elisp for some time.
5 (Efficiency Concerns): Comment out examples that no longer apply.
6 (Compiler Optimizations): Rename from "Optimizing Compiler"; reword.
7 (Creating Symbols, Random Numbers): De-emphasize internal
8 variables cl--gensym-counter and cl--random-state. (Bug#12788)
9 (Naming Conventions, Type Predicates, Macros)
10 (Predicates on Numbers): No longer mention cl-floatp-safe.
11
12012-11-02 Katsumi Yamaoka <yamaoka@jpl.org> 122012-11-02 Katsumi Yamaoka <yamaoka@jpl.org>
2 13
3 * gnus.texi (Mail Source Specifiers): 14 * gnus.texi (Mail Source Specifiers):
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index 4a728049ce8..e182c2600f9 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -229,7 +229,7 @@ by @code{cl--}. Here is a complete list of functions prefixed by
229 229
230@example 230@example
231cl-callf cl-callf2 cl-defsubst 231cl-callf cl-callf2 cl-defsubst
232cl-floatp-safe cl-letf cl-letf* 232cl-letf cl-letf*
233@end example 233@end example
234 234
235@c This is not uninteresting I suppose, but is of zero practical relevance 235@c This is not uninteresting I suppose, but is of zero practical relevance
@@ -239,13 +239,13 @@ they do not cause other components like @file{cl-extra} to be loaded.
239 239
240@example 240@example
241cl-evenp cl-oddp cl-minusp 241cl-evenp cl-oddp cl-minusp
242cl-plusp cl-floatp-safe cl-endp 242cl-plusp cl-endp cl-subst
243cl-copy-list cl-list* cl-ldiff 243cl-copy-list cl-list* cl-ldiff
244cl-rest cl-decf [1] cl-incf [1] 244cl-rest cl-decf [1] cl-incf [1]
245cl-acons cl-adjoin [2] cl-pairlis 245cl-acons cl-adjoin [2] cl-pairlis
246cl-pushnew [1,2] cl-declaim cl-proclaim 246cl-pushnew [1,2] cl-declaim cl-proclaim
247cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth 247cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth
248cl-subst cl-mapcar [3] 248cl-mapcar [3]
249@end example 249@end example
250 250
251@noindent 251@noindent
@@ -300,7 +300,8 @@ calls to it may be expanded into in-line code by the byte compiler.
300This is analogous to the @code{defsubst} form; 300This is analogous to the @code{defsubst} form;
301@code{cl-defsubst} uses a different method (compiler macros) which 301@code{cl-defsubst} uses a different method (compiler macros) which
302works in all versions of Emacs, and also generates somewhat more 302works in all versions of Emacs, and also generates somewhat more
303@c Really? 303@c For some examples,
304@c see http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00009.html
304efficient inline expansions. In particular, @code{cl-defsubst} 305efficient inline expansions. In particular, @code{cl-defsubst}
305arranges for the processing of keyword arguments, default values, 306arranges for the processing of keyword arguments, default values,
306etc., to be done at compile-time whenever possible. 307etc., to be done at compile-time whenever possible.
@@ -702,11 +703,13 @@ The type symbol @code{real} is a synonym for @code{number}, and
702The type symbols @code{character} and @code{string-char} match 703The type symbols @code{character} and @code{string-char} match
703integers in the range from 0 to 255. 704integers in the range from 0 to 255.
704 705
706@c No longer relevant, so covered by first item above (float -> floatp).
707@ignore
705@item 708@item
706The type symbol @code{float} uses the @code{cl-floatp-safe} predicate 709The type symbol @code{float} uses the @code{cl-floatp-safe} predicate
707defined by this package rather than @code{floatp}, so it will work 710defined by this package rather than @code{floatp}, so it will work
708@c FIXME are any such platforms still relevant?
709correctly even in Emacs versions without floating-point support. 711correctly even in Emacs versions without floating-point support.
712@end ignore
710 713
711@item 714@item
712The type list @code{(integer @var{low} @var{high})} represents all 715The type list @code{(integer @var{low} @var{high})} represents all
@@ -833,7 +836,7 @@ constructs.
833* Conditionals:: @code{cl-case}, @code{cl-typecase}. 836* Conditionals:: @code{cl-case}, @code{cl-typecase}.
834* Blocks and Exits:: @code{cl-block}, @code{cl-return}, @code{cl-return-from}. 837* Blocks and Exits:: @code{cl-block}, @code{cl-return}, @code{cl-return-from}.
835* Iteration:: @code{cl-do}, @code{cl-dotimes}, @code{cl-dolist}, @code{cl-do-symbols}. 838* Iteration:: @code{cl-do}, @code{cl-dotimes}, @code{cl-dolist}, @code{cl-do-symbols}.
836* Loop Facility:: The Common Lisp @code{cl-loop} macro. 839* Loop Facility:: The Common Lisp @code{loop} macro.
837* Multiple Values:: @code{cl-values}, @code{cl-multiple-value-bind}, etc. 840* Multiple Values:: @code{cl-values}, @code{cl-multiple-value-bind}, etc.
838@end menu 841@end menu
839 842
@@ -1521,7 +1524,7 @@ Common Lisp @dfn{blocks} provide a non-local exit mechanism very
1521similar to @code{catch} and @code{throw}, with lexical scoping. 1524similar to @code{catch} and @code{throw}, with lexical scoping.
1522This package actually implements @code{cl-block} 1525This package actually implements @code{cl-block}
1523in terms of @code{catch}; however, the lexical scoping allows the 1526in terms of @code{catch}; however, the lexical scoping allows the
1524optimizing byte-compiler to omit the costly @code{catch} step if the 1527byte-compiler to omit the costly @code{catch} step if the
1525body of the block does not actually @code{cl-return-from} the block. 1528body of the block does not actually @code{cl-return-from} the block.
1526 1529
1527@defmac cl-block name forms@dots{} 1530@defmac cl-block name forms@dots{}
@@ -1558,7 +1561,7 @@ just as in Common Lisp.
1558Because they are implemented in terms of Emacs Lisp's @code{catch} 1561Because they are implemented in terms of Emacs Lisp's @code{catch}
1559and @code{throw}, blocks have the same overhead as actual 1562and @code{throw}, blocks have the same overhead as actual
1560@code{catch} constructs (roughly two function calls). However, 1563@code{catch} constructs (roughly two function calls). However,
1561the optimizing byte compiler will optimize away the @code{catch} 1564the byte compiler will optimize away the @code{catch}
1562if the block does 1565if the block does
1563not in fact contain any @code{cl-return} or @code{cl-return-from} calls 1566not in fact contain any @code{cl-return} or @code{cl-return-from} calls
1564that jump to it. This means that @code{cl-do} loops and @code{cl-defun} 1567that jump to it. This means that @code{cl-do} loops and @code{cl-defun}
@@ -1723,18 +1726,18 @@ iterating over vectors or lists.
1723@section Loop Facility 1726@section Loop Facility
1724 1727
1725@noindent 1728@noindent
1726A common complaint with Lisp's traditional looping constructs is 1729A common complaint with Lisp's traditional looping constructs was
1727that they are either too simple and limited, such as Common Lisp's 1730that they were either too simple and limited, such as @code{dotimes}
1728@code{dotimes} or Emacs Lisp's @code{while}, or too unreadable and 1731or @code{while}, or too unreadable and obscure, like Common Lisp's
1729obscure, like Common Lisp's @code{do} loop. 1732@code{do} loop.
1730 1733
1731To remedy this, recent versions of Common Lisp have added a new 1734To remedy this, Common Lisp added a construct called the ``Loop
1732construct called the ``Loop Facility'' or ``@code{loop} macro'', 1735Facility'' or ``@code{loop} macro'', with an easy-to-use but very
1733with an easy-to-use but very powerful and expressive syntax. 1736powerful and expressive syntax.
1734 1737
1735@menu 1738@menu
1736* Loop Basics:: @code{cl-loop} macro, basic clause structure. 1739* Loop Basics:: The @code{cl-loop} macro, basic clause structure.
1737* Loop Examples:: Working examples of @code{cl-loop} macro. 1740* Loop Examples:: Working examples of the @code{cl-loop} macro.
1738* For Clauses:: Clauses introduced by @code{for} or @code{as}. 1741* For Clauses:: Clauses introduced by @code{for} or @code{as}.
1739* Iteration Clauses:: @code{repeat}, @code{while}, @code{thereis}, etc. 1742* Iteration Clauses:: @code{repeat}, @code{while}, @code{thereis}, etc.
1740* Accumulation Clauses:: @code{collect}, @code{sum}, @code{maximize}, etc. 1743* Accumulation Clauses:: @code{collect}, @code{sum}, @code{maximize}, etc.
@@ -1767,9 +1770,9 @@ Common Lisp specifies a certain general order of clauses in a
1767loop: 1770loop:
1768 1771
1769@example 1772@example
1770(cl-loop @var{name-clause} 1773(loop @var{name-clause}
1771 @var{var-clauses}@dots{} 1774 @var{var-clauses}@dots{}
1772 @var{action-clauses}@dots{}) 1775 @var{action-clauses}@dots{})
1773@end example 1776@end example
1774 1777
1775The @var{name-clause} optionally gives a name to the implicit 1778The @var{name-clause} optionally gives a name to the implicit
@@ -1795,10 +1798,10 @@ also use regular Lisp @code{cl-return} or @code{cl-return-from} to
1795break out of the loop.) 1798break out of the loop.)
1796@end defmac 1799@end defmac
1797 1800
1798The following sections give some examples of the Loop Macro in 1801The following sections give some examples of the loop macro in
1799action, and describe the particular loop clauses in great detail. 1802action, and describe the particular loop clauses in great detail.
1800Consult the second edition of Steele for additional discussion 1803Consult the second edition of Steele for additional discussion
1801and examples of the @code{loop} macro. 1804and examples.
1802 1805
1803@node Loop Examples 1806@node Loop Examples
1804@subsection Loop Examples 1807@subsection Loop Examples
@@ -2162,8 +2165,9 @@ that was just set by the previous clause; in the second loop,
2162based on the value of @code{x} left over from the previous time 2165based on the value of @code{x} left over from the previous time
2163through the loop. 2166through the loop.
2164 2167
2165Another feature of the @code{cl-loop} macro is @dfn{destructuring}, 2168Another feature of the @code{cl-loop} macro is @emph{destructuring},
2166similar in concept to the destructuring provided by @code{defmacro}. 2169similar in concept to the destructuring provided by @code{defmacro}
2170(@pxref{Argument Lists}).
2167The @var{var} part of any @code{for} clause can be given as a list 2171The @var{var} part of any @code{for} clause can be given as a list
2168of variables instead of a single variable. The values produced 2172of variables instead of a single variable. The values produced
2169during loop execution must be lists; the values in the lists are 2173during loop execution must be lists; the values in the lists are
@@ -2375,7 +2379,7 @@ by the name @code{it} in the ``then'' part. For example:
2375(setq funny-numbers '(6 13 -1)) 2379(setq funny-numbers '(6 13 -1))
2376 @result{} (6 13 -1) 2380 @result{} (6 13 -1)
2377(cl-loop for x below 10 2381(cl-loop for x below 10
2378 if (oddp x) 2382 if (cl-oddp x)
2379 collect x into odds 2383 collect x into odds
2380 and if (memq x funny-numbers) return (cdr it) end 2384 and if (memq x funny-numbers) return (cdr it) end
2381 else 2385 else
@@ -2441,15 +2445,14 @@ loop. Many of the examples in this section illustrate the use of
2441 2445
2442@item return @var{form} 2446@item return @var{form}
2443This clause causes the loop to return immediately. The following 2447This clause causes the loop to return immediately. The following
2444Lisp form is evaluated to give the return value of the @code{loop} 2448Lisp form is evaluated to give the return value of the loop
2445form. The @code{finally} clauses, if any, are not executed. 2449form. The @code{finally} clauses, if any, are not executed.
2446Of course, @code{return} is generally used inside an @code{if} or 2450Of course, @code{return} is generally used inside an @code{if} or
2447@code{unless}, as its use in a top-level loop clause would mean 2451@code{unless}, as its use in a top-level loop clause would mean
2448the loop would never get to ``loop'' more than once. 2452the loop would never get to ``loop'' more than once.
2449 2453
2450The clause @samp{return @var{form}} is equivalent to 2454The clause @samp{return @var{form}} is equivalent to
2451@c FIXME cl-do, cl-return? 2455@samp{do (cl-return @var{form})} (or @code{cl-return-from} if the loop
2452@samp{do (return @var{form})} (or @code{return-from} if the loop
2453was named). The @code{return} clause is implemented a bit more 2456was named). The @code{return} clause is implemented a bit more
2454efficiently, though. 2457efficiently, though.
2455@end table 2458@end table
@@ -2463,7 +2466,7 @@ clause, respectively. Consult the source code in file
2463 2466
2464This package's @code{cl-loop} macro is compatible with that of Common 2467This package's @code{cl-loop} macro is compatible with that of Common
2465Lisp, except that a few features are not implemented: @code{loop-finish} 2468Lisp, except that a few features are not implemented: @code{loop-finish}
2466and data-type specifiers. Naturally, the @code{for} clauses which 2469and data-type specifiers. Naturally, the @code{for} clauses that
2467iterate over keymaps, overlays, intervals, frames, windows, and 2470iterate over keymaps, overlays, intervals, frames, windows, and
2468buffers are Emacs-specific extensions. 2471buffers are Emacs-specific extensions.
2469 2472
@@ -2516,17 +2519,17 @@ Destructuring is made available to the user by way of the
2516following macro: 2519following macro:
2517 2520
2518@defmac cl-destructuring-bind arglist expr forms@dots{} 2521@defmac cl-destructuring-bind arglist expr forms@dots{}
2519This macro expands to code which executes @var{forms}, with 2522This macro expands to code that executes @var{forms}, with
2520the variables in @var{arglist} bound to the list of values 2523the variables in @var{arglist} bound to the list of values
2521returned by @var{expr}. The @var{arglist} can include all 2524returned by @var{expr}. The @var{arglist} can include all
2522the features allowed for @code{defmacro} argument lists, 2525the features allowed for @code{cl-defmacro} argument lists,
2523including destructuring. (The @code{&environment} keyword 2526including destructuring. (The @code{&environment} keyword
2524is not allowed.) The macro expansion will signal an error 2527is not allowed.) The macro expansion will signal an error
2525if @var{expr} returns a list of the wrong number of arguments 2528if @var{expr} returns a list of the wrong number of arguments
2526or with incorrect keyword arguments. 2529or with incorrect keyword arguments.
2527@end defmac 2530@end defmac
2528 2531
2529This package also includes the Common Lisp @code{cl-define-compiler-macro} 2532This package also includes the Common Lisp @code{define-compiler-macro}
2530facility, which allows you to define compile-time expansions and 2533facility, which allows you to define compile-time expansions and
2531optimizations for your functions. 2534optimizations for your functions.
2532 2535
@@ -2551,7 +2554,7 @@ appears as a standard part of this package:
2551(cl-define-compiler-macro cl-member (&whole form a list &rest keys) 2554(cl-define-compiler-macro cl-member (&whole form a list &rest keys)
2552 (if (and (null keys) 2555 (if (and (null keys)
2553 (eq (car-safe a) 'quote) 2556 (eq (car-safe a) 'quote)
2554 (not (floatp-safe (cadr a)))) 2557 (not (floatp (cadr a))))
2555 (list 'memq a list) 2558 (list 'memq a list)
2556 form)) 2559 form))
2557@end example 2560@end example
@@ -2589,16 +2592,19 @@ mechanism that allows you to give the compiler special hints
2589about the types of data that will be stored in particular variables, 2592about the types of data that will be stored in particular variables,
2590and about the ways those variables and functions will be used. This 2593and about the ways those variables and functions will be used. This
2591package defines versions of all the Common Lisp declaration forms: 2594package defines versions of all the Common Lisp declaration forms:
2592@code{cl-declare}, @code{cl-locally}, @code{cl-proclaim}, @code{cl-declaim}, 2595@code{declare}, @code{locally}, @code{proclaim}, @code{declaim},
2593and @code{cl-the}. 2596and @code{the}.
2594 2597
2595Most of the Common Lisp declarations are not currently useful in 2598Most of the Common Lisp declarations are not currently useful in Emacs
2596Emacs Lisp, as the byte-code system provides little opportunity 2599Lisp. For example, the byte-code system provides little
2597to benefit from type information, and @code{special} declarations 2600opportunity to benefit from type information.
2598are redundant in a fully dynamically-scoped Lisp. A few 2601@ignore
2599declarations are meaningful when the optimizing byte 2602and @code{special} declarations are redundant in a fully
2600compiler is being used, however. Under the earlier non-optimizing 2603dynamically-scoped Lisp.
2601compiler, these declarations will effectively be ignored. 2604@end ignore
2605A few declarations are meaningful when byte compiler optimizations
2606are enabled, as they are by the default. Otherwise these
2607declarations will effectively be ignored.
2602 2608
2603@defun cl-proclaim decl-spec 2609@defun cl-proclaim decl-spec
2604This function records a ``global'' declaration specified by 2610This function records a ``global'' declaration specified by
@@ -2609,7 +2615,7 @@ is evaluated and thus should normally be quoted.
2609@defmac cl-declaim decl-specs@dots{} 2615@defmac cl-declaim decl-specs@dots{}
2610This macro is like @code{cl-proclaim}, except that it takes any number 2616This macro is like @code{cl-proclaim}, except that it takes any number
2611of @var{decl-spec} arguments, and the arguments are unevaluated and 2617of @var{decl-spec} arguments, and the arguments are unevaluated and
2612unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when 2618unquoted. The @code{cl-declaim} macro also puts @code{(cl-eval-when
2613(compile load eval) @dots{})} around the declarations so that they will 2619(compile load eval) @dots{})} around the declarations so that they will
2614be registered at compile-time as well as at run-time. (This is vital, 2620be registered at compile-time as well as at run-time. (This is vital,
2615since normally the declarations are meant to influence the way the 2621since normally the declarations are meant to influence the way the
@@ -2632,9 +2638,9 @@ In this package, @code{cl-locally} is no different from @code{progn}.
2632 2638
2633@defmac cl-the type form 2639@defmac cl-the type form
2634Type information provided by @code{cl-the} is ignored in this package; 2640Type information provided by @code{cl-the} is ignored in this package;
2635in other words, @code{(cl-the @var{type} @var{form})} is equivalent 2641in other words, @code{(cl-the @var{type} @var{form})} is equivalent to
2636to @var{form}. Future versions of the optimizing byte-compiler may 2642@var{form}. Future byte-compiler optimizations may make use of this
2637make use of this information. 2643information.
2638 2644
2639For example, @code{mapcar} can map over both lists and arrays. It is 2645For example, @code{mapcar} can map over both lists and arrays. It is
2640hard for the compiler to expand @code{mapcar} into an in-line loop 2646hard for the compiler to expand @code{mapcar} into an in-line loop
@@ -2655,35 +2661,31 @@ such as @code{type} and @code{ftype}, are silently ignored.
2655 2661
2656@table @code 2662@table @code
2657@item special 2663@item special
2664@c FIXME ?
2658Since all variables in Emacs Lisp are ``special'' (in the Common 2665Since all variables in Emacs Lisp are ``special'' (in the Common
2659Lisp sense), @code{special} declarations are only advisory. They 2666Lisp sense), @code{special} declarations are only advisory. They
2660simply tell the optimizing byte compiler that the specified 2667simply tell the byte compiler that the specified
2661variables are intentionally being referred to without being 2668variables are intentionally being referred to without being
2662bound in the body of the function. The compiler normally emits 2669bound in the body of the function. The compiler normally emits
2663warnings for such references, since they could be typographical 2670warnings for such references, since they could be typographical
2664errors for references to local variables. 2671errors for references to local variables.
2665 2672
2666The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is 2673The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is
2667equivalent to @code{(defvar @var{var1}) (defvar @var{var2})} in the 2674equivalent to @code{(defvar @var{var1}) (defvar @var{var2})}.
2668optimizing compiler, or to nothing at all in older compilers (which
2669do not warn for non-local references).
2670 2675
2671In top-level contexts, it is generally better to write 2676In top-level contexts, it is generally better to write
2672@code{(defvar @var{var})} than @code{(cl-declaim (special @var{var}))}, 2677@code{(defvar @var{var})} than @code{(cl-declaim (special @var{var}))},
2673since @code{defvar} makes your intentions clearer. But the older 2678since @code{defvar} makes your intentions clearer.
2674byte compilers can not handle @code{defvar}s appearing inside of
2675functions, while @code{(cl-declare (special @var{var}))} takes care
2676to work correctly with all compilers.
2677 2679
2678@item inline 2680@item inline
2679The @code{inline} @var{decl-spec} lists one or more functions 2681The @code{inline} @var{decl-spec} lists one or more functions
2680whose bodies should be expanded ``in-line'' into calling functions 2682whose bodies should be expanded ``in-line'' into calling functions
2681whenever the compiler is able to arrange for it. For example, 2683whenever the compiler is able to arrange for it. For example,
2682the Common Lisp function @code{cadr} is declared @code{inline} 2684the function @code{cl-acons} is declared @code{inline}
2683by this package so that the form @code{(cadr @var{x})} will 2685by this package so that the form @code{(cl-acons @var{key} @var{value}
2684expand directly into @code{(car (cdr @var{x}))} when it is called 2686@var{alist})} will
2685in user functions, for a savings of one (relatively expensive) 2687expand directly into @code{(cons (cons @var{key} @var{value}) @var{alist})}
2686function call. 2688when it is called in user functions, so as to save function calls.
2687 2689
2688The following declarations are all equivalent. Note that the 2690The following declarations are all equivalent. Note that the
2689@code{defsubst} form is a convenient way to define a function 2691@code{defsubst} form is a convenient way to define a function
@@ -2702,7 +2704,7 @@ request that a function you have defined should be inlined,
2702but it is impolite to use it to request inlining of an external 2704but it is impolite to use it to request inlining of an external
2703function. 2705function.
2704 2706
2705In Common Lisp, it is possible to use @code{(cl-declare (inline @dots{}))} 2707In Common Lisp, it is possible to use @code{(declare (inline @dots{}))}
2706before a particular call to a function to cause just that call to 2708before a particular call to a function to cause just that call to
2707be inlined; the current byte compilers provide no way to implement 2709be inlined; the current byte compilers provide no way to implement
2708this, so @code{(cl-declare (inline @dots{}))} is currently ignored by 2710this, so @code{(cl-declare (inline @dots{}))} is currently ignored by
@@ -2715,8 +2717,7 @@ declaration.
2715 2717
2716@item optimize 2718@item optimize
2717This declaration controls how much optimization is performed by 2719This declaration controls how much optimization is performed by
2718the compiler. Naturally, it is ignored by the earlier non-optimizing 2720the compiler.
2719compilers.
2720 2721
2721The word @code{optimize} is followed by any number of lists like 2722The word @code{optimize} is followed by any number of lists like
2722@code{(speed 3)} or @code{(safety 2)}. Common Lisp defines several 2723@code{(speed 3)} or @code{(safety 2)}. Common Lisp defines several
@@ -2725,8 +2726,7 @@ and @code{safety}. The value of a quality should be an integer from
27250 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''. 27260 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''.
2726The default level for both qualities is 1. 2727The default level for both qualities is 1.
2727 2728
2728In this package, with the optimizing compiler, the 2729In this package, the @code{speed} quality is tied to the @code{byte-optimize}
2729@code{speed} quality is tied to the @code{byte-optimize}
2730flag, which is set to @code{nil} for @code{(speed 0)} and to 2730flag, which is set to @code{nil} for @code{(speed 0)} and to
2731@code{t} for higher settings; and the @code{safety} quality is 2731@code{t} for higher settings; and the @code{safety} quality is
2732tied to the @code{byte-compile-delete-errors} flag, which is 2732tied to the @code{byte-compile-delete-errors} flag, which is
@@ -2745,22 +2745,22 @@ just because of an error in a fully-optimized Lisp program.
2745 2745
2746The @code{optimize} declaration is normally used in a top-level 2746The @code{optimize} declaration is normally used in a top-level
2747@code{cl-proclaim} or @code{cl-declaim} in a file; Common Lisp allows 2747@code{cl-proclaim} or @code{cl-declaim} in a file; Common Lisp allows
2748it to be used with @code{cl-declare} to set the level of optimization 2748it to be used with @code{declare} to set the level of optimization
2749locally for a given form, but this will not work correctly with the 2749locally for a given form, but this will not work correctly with the
2750current version of the optimizing compiler. (The @code{cl-declare} 2750current byte-compiler. (The @code{cl-declare}
2751will set the new optimization level, but that level will not 2751will set the new optimization level, but that level will not
2752automatically be unset after the enclosing form is done.) 2752automatically be unset after the enclosing form is done.)
2753 2753
2754@item warn 2754@item warn
2755This declaration controls what sorts of warnings are generated 2755This declaration controls what sorts of warnings are generated
2756by the byte compiler. Again, only the optimizing compiler 2756by the byte compiler. The word @code{warn} is followed by any
2757generates warnings. The word @code{warn} is followed by any
2758number of ``warning qualities'', similar in form to optimization 2757number of ``warning qualities'', similar in form to optimization
2759qualities. The currently supported warning types are 2758qualities. The currently supported warning types are
2760@code{redefine}, @code{callargs}, @code{unresolved}, and 2759@code{redefine}, @code{callargs}, @code{unresolved}, and
2761@code{free-vars}; in the current system, a value of 0 will 2760@code{free-vars}; in the current system, a value of 0 will
2762disable these warnings and any higher value will enable them. 2761disable these warnings and any higher value will enable them.
2763See the documentation for the optimizing byte compiler for details. 2762See the documentation of the variable @code{byte-compile-warnings}
2763for more details.
2764@end table 2764@end table
2765 2765
2766@node Symbols 2766@node Symbols
@@ -2867,25 +2867,24 @@ temporary variables.
2867This function creates a new, uninterned symbol (using @code{make-symbol}) 2867This function creates a new, uninterned symbol (using @code{make-symbol})
2868with a unique name. (The name of an uninterned symbol is relevant 2868with a unique name. (The name of an uninterned symbol is relevant
2869only if the symbol is printed.) By default, the name is generated 2869only if the symbol is printed.) By default, the name is generated
2870@c FIXME no longer true?
2870from an increasing sequence of numbers, @samp{G1000}, @samp{G1001}, 2871from an increasing sequence of numbers, @samp{G1000}, @samp{G1001},
2871@samp{G1002}, etc. If the optional argument @var{x} is a string, that 2872@samp{G1002}, etc. If the optional argument @var{x} is a string, that
2872string is used as a prefix instead of @samp{G}. Uninterned symbols 2873string is used as a prefix instead of @samp{G}. Uninterned symbols
2873are used in macro expansions for temporary variables, to ensure that 2874are used in macro expansions for temporary variables, to ensure that
2874their names will not conflict with ``real'' variables in the user's 2875their names will not conflict with ``real'' variables in the user's
2875code. 2876code.
2876@end defun
2877 2877
2878@defvar cl--gensym-counter 2878(Internally, the variable @code{cl--gensym-counter} holds the counter
2879This variable holds the counter used to generate @code{cl-gensym} names. 2879used to generate names. It is incremented after each use. In Common
2880It is incremented after each use by @code{cl-gensym}. In Common Lisp 2880Lisp this is initialized with 0, but this package initializes it with
2881this is initialized with 0, but this package initializes it with a 2881a random time-dependent value to avoid trouble when two files that
2882random (time-dependent) value to avoid trouble when two files that
2883each used @code{cl-gensym} in their compilation are loaded together. 2882each used @code{cl-gensym} in their compilation are loaded together.
2884(Uninterned symbols become interned when the compiler writes them 2883Uninterned symbols become interned when the compiler writes them out
2885out to a file and the Emacs loader loads them, so their names have to 2884to a file and the Emacs loader loads them, so their names have to be
2886be treated a bit more carefully than in Common Lisp where uninterned 2885treated a bit more carefully than in Common Lisp where uninterned
2887symbols remain uninterned after loading.) 2886symbols remain uninterned after loading.)
2888@end defvar 2887@end defun
2889 2888
2890@defun cl-gentemp &optional x 2889@defun cl-gentemp &optional x
2891This function is like @code{cl-gensym}, except that it produces a new 2890This function is like @code{cl-gensym}, except that it produces a new
@@ -2905,13 +2904,13 @@ provided.
2905 2904
2906@noindent 2905@noindent
2907This section defines a few simple Common Lisp operations on numbers 2906This section defines a few simple Common Lisp operations on numbers
2908which were left out of Emacs Lisp. 2907that were left out of Emacs Lisp.
2909 2908
2910@menu 2909@menu
2911* Predicates on Numbers:: @code{cl-plusp}, @code{cl-oddp}, @code{cl-floatp-safe}, etc. 2910* Predicates on Numbers:: @code{cl-plusp}, @code{cl-oddp}, etc.
2912* Numerical Functions:: @code{abs}, @code{cl-floor}, etc. 2911* Numerical Functions:: @code{cl-floor}, @code{cl-ceiling}, etc.
2913* Random Numbers:: @code{cl-random}, @code{cl-make-random-state}. 2912* Random Numbers:: @code{cl-random}, @code{cl-make-random-state}.
2914* Implementation Parameters:: @code{cl-most-positive-float}. 2913* Implementation Parameters:: @code{cl-most-positive-float}, etc.
2915@end menu 2914@end menu
2916 2915
2917@node Predicates on Numbers 2916@node Predicates on Numbers
@@ -2941,11 +2940,13 @@ This predicate tests whether @var{integer} is even. It is an
2941error if the argument is not an integer. 2940error if the argument is not an integer.
2942@end defun 2941@end defun
2943 2942
2943@ignore
2944@defun cl-floatp-safe object 2944@defun cl-floatp-safe object
2945This predicate tests whether @var{object} is a floating-point 2945This predicate tests whether @var{object} is a floating-point
2946number. On systems that support floating-point, this is equivalent 2946number. On systems that support floating-point, this is equivalent
2947to @code{floatp}. On other systems, this always returns @code{nil}. 2947to @code{floatp}. On other systems, this always returns @code{nil}.
2948@end defun 2948@end defun
2949@end ignore
2949 2950
2950@node Numerical Functions 2951@node Numerical Functions
2951@section Numerical Functions 2952@section Numerical Functions
@@ -3036,6 +3037,7 @@ of @code{cl-truncate}.
3036This package also provides an implementation of the Common Lisp 3037This package also provides an implementation of the Common Lisp
3037random number generator. It uses its own additive-congruential 3038random number generator. It uses its own additive-congruential
3038algorithm, which is much more likely to give statistically clean 3039algorithm, which is much more likely to give statistically clean
3040@c FIXME? Still true?
3039random numbers than the simple generators supplied by many 3041random numbers than the simple generators supplied by many
3040operating systems. 3042operating systems.
3041 3043
@@ -3043,22 +3045,16 @@ operating systems.
3043This function returns a random nonnegative number less than 3045This function returns a random nonnegative number less than
3044@var{number}, and of the same type (either integer or floating-point). 3046@var{number}, and of the same type (either integer or floating-point).
3045The @var{state} argument should be a @code{random-state} object 3047The @var{state} argument should be a @code{random-state} object
3046which holds the state of the random number generator. The 3048that holds the state of the random number generator. The
3047function modifies this state object as a side effect. If 3049function modifies this state object as a side effect. If
3048@var{state} is omitted, it defaults to the variable 3050@var{state} is omitted, it defaults to the internal variable
3049@code{cl--random-state}, which contains a pre-initialized 3051@code{cl--random-state}, which contains a pre-initialized
3050@code{random-state} object. 3052default @code{random-state} object. (Since any number of programs in
3053the Emacs process may be accessing @code{cl--random-state} in
3054interleaved fashion, the sequence generated from this will be
3055irreproducible for all intents and purposes.)
3051@end defun 3056@end defun
3052 3057
3053@defvar cl--random-state
3054This variable contains the system ``default'' @code{random-state}
3055object, used for calls to @code{cl-random} that do not specify an
3056alternative state object. Since any number of programs in the
3057Emacs process may be accessing @code{cl--random-state} in interleaved
3058fashion, the sequence generated from this variable will be
3059irreproducible for all intents and purposes.
3060@end defvar
3061
3062@defun cl-make-random-state &optional state 3058@defun cl-make-random-state &optional state
3063This function creates or copies a @code{random-state} object. 3059This function creates or copies a @code{random-state} object.
3064If @var{state} is omitted or @code{nil}, it returns a new copy of 3060If @var{state} is omitted or @code{nil}, it returns a new copy of
@@ -3094,10 +3090,10 @@ This predicate returns @code{t} if @var{object} is a
3094@section Implementation Parameters 3090@section Implementation Parameters
3095 3091
3096@noindent 3092@noindent
3097This package defines several useful constants having to with numbers. 3093This package defines several useful constants having to do with
3094floating-point numbers.
3098 3095
3099The following parameters have to do with floating-point numbers. 3096It determines their values by exercising the computer's
3100This package determines their values by exercising the computer's
3101floating-point arithmetic in various ways. Because this operation 3097floating-point arithmetic in various ways. Because this operation
3102might be slow, the code for initializing them is kept in a separate 3098might be slow, the code for initializing them is kept in a separate
3103function that must be called before the parameters can be used. 3099function that must be called before the parameters can be used.
@@ -3105,12 +3101,13 @@ function that must be called before the parameters can be used.
3105@defun cl-float-limits 3101@defun cl-float-limits
3106This function makes sure that the Common Lisp floating-point parameters 3102This function makes sure that the Common Lisp floating-point parameters
3107like @code{cl-most-positive-float} have been initialized. Until it is 3103like @code{cl-most-positive-float} have been initialized. Until it is
3108called, these parameters will be @code{nil}. If this version of Emacs 3104called, these parameters will be @code{nil}.
3109does not support floats, the parameters will remain @code{nil}. If the 3105@c If this version of Emacs does not support floats, the parameters will
3110parameters have already been initialized, the function returns 3106@c remain @code{nil}.
3107If the parameters have already been initialized, the function returns
3111immediately. 3108immediately.
3112 3109
3113The algorithm makes assumptions that will be valid for most modern 3110The algorithm makes assumptions that will be valid for almost all
3114machines, but will fail if the machine's arithmetic is extremely 3111machines, but will fail if the machine's arithmetic is extremely
3115unusual, e.g., decimal. 3112unusual, e.g., decimal.
3116@end defun 3113@end defun
@@ -3130,7 +3127,7 @@ is approximately @code{1.79e+308}.
3130@end defvar 3127@end defvar
3131 3128
3132@defvar cl-most-negative-float 3129@defvar cl-most-negative-float
3133This constant equals the most-negative value a Lisp float can hold. 3130This constant equals the most negative value a Lisp float can hold.
3134(It is assumed to be equal to @code{(- cl-most-positive-float)}.) 3131(It is assumed to be equal to @code{(- cl-most-positive-float)}.)
3135@end defvar 3132@end defvar
3136 3133
@@ -3199,7 +3196,7 @@ may appear in any order.
3199The @code{:key} argument should be passed either @code{nil}, or a 3196The @code{:key} argument should be passed either @code{nil}, or a
3200function of one argument. This key function is used as a filter 3197function of one argument. This key function is used as a filter
3201through which the elements of the sequence are seen; for example, 3198through which the elements of the sequence are seen; for example,
3202@code{(cl-find x y :key 'car)} is similar to @code{(cl-assoc x y)}: 3199@code{(cl-find x y :key 'car)} is similar to @code{(cl-assoc x y)}.
3203It searches for an element of the list whose @sc{car} equals 3200It searches for an element of the list whose @sc{car} equals
3204@code{x}, rather than for an element which equals @code{x} itself. 3201@code{x}, rather than for an element which equals @code{x} itself.
3205If @code{:key} is omitted or @code{nil}, the filter is effectively 3202If @code{:key} is omitted or @code{nil}, the filter is effectively
@@ -3217,7 +3214,7 @@ true (non-@code{nil}) to indicate a match; instead, you may use
3217@code{:test-not} to give a function which returns @emph{false} to 3214@code{:test-not} to give a function which returns @emph{false} to
3218indicate a match. The default test function is @code{eql}. 3215indicate a match. The default test function is @code{eql}.
3219 3216
3220Many functions which take @var{item} and @code{:test} or @code{:test-not} 3217Many functions that take @var{item} and @code{:test} or @code{:test-not}
3221arguments also come in @code{-if} and @code{-if-not} varieties, 3218arguments also come in @code{-if} and @code{-if-not} varieties,
3222where a @var{predicate} function is passed instead of @var{item}, 3219where a @var{predicate} function is passed instead of @var{item},
3223and sequence elements match if the predicate returns true on them 3220and sequence elements match if the predicate returns true on them
@@ -3231,7 +3228,7 @@ and sequence elements match if the predicate returns true on them
3231to remove all zeros from sequence @code{seq}. 3228to remove all zeros from sequence @code{seq}.
3232 3229
3233Some operations can work on a subsequence of the argument sequence; 3230Some operations can work on a subsequence of the argument sequence;
3234these function take @code{:start} and @code{:end} arguments which 3231these function take @code{:start} and @code{:end} arguments, which
3235default to zero and the length of the sequence, respectively. 3232default to zero and the length of the sequence, respectively.
3236Only elements between @var{start} (inclusive) and @var{end} 3233Only elements between @var{start} (inclusive) and @var{end}
3237(exclusive) are affected by the operation. The @var{end} argument 3234(exclusive) are affected by the operation. The @var{end} argument
@@ -3339,7 +3336,7 @@ the return values using @code{nconc}.
3339@defun cl-some predicate seq &rest more-seqs 3336@defun cl-some predicate seq &rest more-seqs
3340This function calls @var{predicate} on each element of @var{seq} 3337This function calls @var{predicate} on each element of @var{seq}
3341in turn; if @var{predicate} returns a non-@code{nil} value, 3338in turn; if @var{predicate} returns a non-@code{nil} value,
3342@code{some} returns that value, otherwise it returns @code{nil}. 3339@code{cl-some} returns that value, otherwise it returns @code{nil}.
3343Given several sequence arguments, it steps through the sequences 3340Given several sequence arguments, it steps through the sequences
3344in parallel until the shortest one runs out, just as in 3341in parallel until the shortest one runs out, just as in
3345@code{cl-mapcar}. You can rely on the left-to-right order in which 3342@code{cl-mapcar}. You can rely on the left-to-right order in which
@@ -3388,7 +3385,7 @@ of left-associative:
3388 @equiv{} (- 1 (- 2 (- 3 4))) @result{} -2 3385 @equiv{} (- 1 (- 2 (- 3 4))) @result{} -2
3389@end example 3386@end example
3390 3387
3391If @code{:key} is specified, it is a function of one argument which 3388If @code{:key} is specified, it is a function of one argument, which
3392is called on each of the sequence elements in turn. 3389is called on each of the sequence elements in turn.
3393 3390
3394If @code{:initial-value} is specified, it is effectively added to the 3391If @code{:initial-value} is specified, it is effectively added to the
@@ -3457,7 +3454,7 @@ of data copied is simply the shorter of the source and destination
3457If @var{seq1} and @var{seq2} are @code{eq}, then the replacement 3454If @var{seq1} and @var{seq2} are @code{eq}, then the replacement
3458will work correctly even if the regions indicated by the start 3455will work correctly even if the regions indicated by the start
3459and end arguments overlap. However, if @var{seq1} and @var{seq2} 3456and end arguments overlap. However, if @var{seq1} and @var{seq2}
3460are lists which share storage but are not @code{eq}, and the 3457are lists that share storage but are not @code{eq}, and the
3461start and end arguments specify overlapping regions, the effect 3458start and end arguments specify overlapping regions, the effect
3462is undefined. 3459is undefined.
3463@end defun 3460@end defun
@@ -3480,7 +3477,7 @@ if @var{count} was also specified).
3480@end defun 3477@end defun
3481 3478
3482@defun cl-delete item seq @t{&key :test :test-not :key :count :start :end :from-end} 3479@defun cl-delete item seq @t{&key :test :test-not :key :count :start :end :from-end}
3483This deletes all elements of @var{seq} which match @var{item}. 3480This deletes all elements of @var{seq} that match @var{item}.
3484It is a destructive operation. Since Emacs Lisp does not support 3481It is a destructive operation. Since Emacs Lisp does not support
3485stretchable strings or vectors, this is the same as @code{cl-remove} 3482stretchable strings or vectors, this is the same as @code{cl-remove}
3486for those sequence types. On lists, @code{cl-remove} will copy the 3483for those sequence types. On lists, @code{cl-remove} will copy the
@@ -3580,7 +3577,7 @@ elements match (according to @code{:test}, @code{:test-not},
3580and @code{:key}), the function returns @code{nil}. If there is 3577and @code{:key}), the function returns @code{nil}. If there is
3581a mismatch, the function returns the index (relative to @var{seq1}) 3578a mismatch, the function returns the index (relative to @var{seq1})
3582of the first mismatching element. This will be the leftmost pair of 3579of the first mismatching element. This will be the leftmost pair of
3583elements which do not match, or the position at which the shorter of 3580elements that do not match, or the position at which the shorter of
3584the two otherwise-matching sequences runs out. 3581the two otherwise-matching sequences runs out.
3585 3582
3586If @code{:from-end} is true, then the elements are compared from right 3583If @code{:from-end} is true, then the elements are compared from right
@@ -3595,7 +3592,7 @@ which compares two strings case-insensitively.
3595@defun cl-search seq1 seq2 @t{&key :test :test-not :key :from-end :start1 :end1 :start2 :end2} 3592@defun cl-search seq1 seq2 @t{&key :test :test-not :key :from-end :start1 :end1 :start2 :end2}
3596This function searches @var{seq2} for a subsequence that matches 3593This function searches @var{seq2} for a subsequence that matches
3597@var{seq1} (or part of it specified by @code{:start1} and 3594@var{seq1} (or part of it specified by @code{:start1} and
3598@code{:end1}.) Only matches which fall entirely within the region 3595@code{:end1}). Only matches that fall entirely within the region
3599defined by @code{:start2} and @code{:end2} will be considered. 3596defined by @code{:start2} and @code{:end2} will be considered.
3600The return value is the index of the leftmost element of the 3597The return value is the index of the leftmost element of the
3601leftmost match, relative to the start of @var{seq2}, or @code{nil} 3598leftmost match, relative to the start of @var{seq2}, or @code{nil}
@@ -3606,7 +3603,7 @@ function finds the @emph{rightmost} matching subsequence.
3606@node Sorting Sequences 3603@node Sorting Sequences
3607@section Sorting Sequences 3604@section Sorting Sequences
3608 3605
3609@defun clsort seq predicate @t{&key :key} 3606@defun cl-sort seq predicate @t{&key :key}
3610This function sorts @var{seq} into increasing order as determined 3607This function sorts @var{seq} into increasing order as determined
3611by using @var{predicate} to compare pairs of elements. @var{predicate} 3608by using @var{predicate} to compare pairs of elements. @var{predicate}
3612should return true (non-@code{nil}) if and only if its first argument 3609should return true (non-@code{nil}) if and only if its first argument
@@ -3617,7 +3614,7 @@ numbers into decreasing rather than increasing order.
3617 3614
3618This function differs from Emacs's built-in @code{sort} in that it 3615This function differs from Emacs's built-in @code{sort} in that it
3619can operate on any type of sequence, not just lists. Also, it 3616can operate on any type of sequence, not just lists. Also, it
3620accepts a @code{:key} argument which is used to preprocess data 3617accepts a @code{:key} argument, which is used to preprocess data
3621fed to the @var{predicate} function. For example, 3618fed to the @var{predicate} function. For example,
3622 3619
3623@example 3620@example
@@ -3628,7 +3625,7 @@ fed to the @var{predicate} function. For example,
3628sorts @var{data}, a sequence of strings, into increasing alphabetical 3625sorts @var{data}, a sequence of strings, into increasing alphabetical
3629order without regard to case. A @code{:key} function of @code{car} 3626order without regard to case. A @code{:key} function of @code{car}
3630would be useful for sorting association lists. It should only be a 3627would be useful for sorting association lists. It should only be a
3631simple accessor though, it's used heavily in the current 3628simple accessor though, since it's used heavily in the current
3632implementation. 3629implementation.
3633 3630
3634The @code{cl-sort} function is destructive; it sorts lists by actually 3631The @code{cl-sort} function is destructive; it sorts lists by actually
@@ -3684,7 +3681,7 @@ i.e., chains of cons cells.
3684 3681
3685@defun cl-caddr x 3682@defun cl-caddr x
3686This function is equivalent to @code{(car (cdr (cdr @var{x})))}. 3683This function is equivalent to @code{(car (cdr (cdr @var{x})))}.
3687Likewise, this package defines all 28 @code{c@var{xxx}r} functions 3684Likewise, this package defines all 24 @code{c@var{xxx}r} functions
3688where @var{xxx} is up to four @samp{a}s and/or @samp{d}s. 3685where @var{xxx} is up to four @samp{a}s and/or @samp{d}s.
3689All of these functions are @code{setf}-able, and calls to them 3686All of these functions are @code{setf}-able, and calls to them
3690are expanded inline by the byte-compiler for maximum efficiency. 3687are expanded inline by the byte-compiler for maximum efficiency.
@@ -3712,7 +3709,8 @@ This function returns the length of list @var{x}, exactly like
3712@code{(length @var{x})}, except that if @var{x} is a circular 3709@code{(length @var{x})}, except that if @var{x} is a circular
3713list (where the @sc{cdr}-chain forms a loop rather than terminating 3710list (where the @sc{cdr}-chain forms a loop rather than terminating
3714with @code{nil}), this function returns @code{nil}. (The regular 3711with @code{nil}), this function returns @code{nil}. (The regular
3715@code{length} function would get stuck if given a circular list.) 3712@code{length} function would get stuck if given a circular list.
3713See also the @code{safe-length} function.)
3716@end defun 3714@end defun
3717 3715
3718@defun cl-list* arg &rest others 3716@defun cl-list* arg &rest others
@@ -3740,18 +3738,6 @@ This function returns a copy of the list @var{list}. It copies
3740dotted lists like @code{(1 2 . 3)} correctly. 3738dotted lists like @code{(1 2 . 3)} correctly.
3741@end defun 3739@end defun
3742 3740
3743@defun copy-tree x &optional vecp
3744This function returns a copy of the tree of cons cells @var{x}.
3745@c FIXME? cl-copy-list is not an alias of copy-sequence.
3746Unlike @code{copy-sequence} (and its alias @code{cl-copy-list}),
3747which copies only along the @sc{cdr} direction, this function
3748copies (recursively) along both the @sc{car} and the @sc{cdr}
3749directions. If @var{x} is not a cons cell, the function simply
3750returns @var{x} unchanged. If the optional @var{vecp} argument
3751is true, this function copies vectors (recursively) as well as
3752cons cells.
3753@end defun
3754
3755@defun cl-tree-equal x y @t{&key :test :test-not :key} 3741@defun cl-tree-equal x y @t{&key :test :test-not :key}
3756This function compares two trees of cons cells. If @var{x} and 3742This function compares two trees of cons cells. If @var{x} and
3757@var{y} are both cons cells, their @sc{car}s and @sc{cdr}s are 3743@var{y} are both cons cells, their @sc{car}s and @sc{cdr}s are
@@ -3814,7 +3800,7 @@ This is a destructive version of @code{cl-sublis}.
3814@section Lists as Sets 3800@section Lists as Sets
3815 3801
3816@noindent 3802@noindent
3817These functions perform operations on lists which represent sets 3803These functions perform operations on lists that represent sets
3818of elements. 3804of elements.
3819 3805
3820@defun cl-member item list @t{&key :test :test-not :key} 3806@defun cl-member item list @t{&key :test :test-not :key}
@@ -3827,13 +3813,14 @@ are compared by @code{eql} by default; you can use the @code{:test},
3827 3813
3828The standard Emacs lisp function @code{member} uses @code{equal} for 3814The standard Emacs lisp function @code{member} uses @code{equal} for
3829comparisons; it is equivalent to @code{(cl-member @var{item} @var{list} 3815comparisons; it is equivalent to @code{(cl-member @var{item} @var{list}
3830:test 'equal)}. 3816:test 'equal)}. With no keyword arguments, @code{cl-member} is
3817equivalent to @code{memq}.
3831@end defun 3818@end defun
3832 3819
3833@findex cl-member-if 3820@findex cl-member-if
3834@findex cl-member-if-not 3821@findex cl-member-if-not
3835The @code{cl-member-if} and @code{cl-member-if-not} functions 3822The @code{cl-member-if} and @code{cl-member-if-not} functions
3836analogously search for elements which satisfy a given predicate. 3823analogously search for elements that satisfy a given predicate.
3837 3824
3838@defun cl-tailp sublist list 3825@defun cl-tailp sublist list
3839This function returns @code{t} if @var{sublist} is a sublist of 3826This function returns @code{t} if @var{sublist} is a sublist of
@@ -3852,11 +3839,11 @@ become part of the list.
3852@end defun 3839@end defun
3853 3840
3854@defun cl-union list1 list2 @t{&key :test :test-not :key} 3841@defun cl-union list1 list2 @t{&key :test :test-not :key}
3855This function combines two lists which represent sets of items, 3842This function combines two lists that represent sets of items,
3856returning a list that represents the union of those two sets. 3843returning a list that represents the union of those two sets.
3857The result list will contain all items which appear in @var{list1} 3844The resulting list contains all items that appear in @var{list1}
3858or @var{list2}, and no others. If an item appears in both 3845or @var{list2}, and no others. If an item appears in both
3859@var{list1} and @var{list2} it will be copied only once. If 3846@var{list1} and @var{list2} it is copied only once. If
3860an item is duplicated in @var{list1} or @var{list2}, it is 3847an item is duplicated in @var{list1} or @var{list2}, it is
3861undefined whether or not that duplication will survive in the 3848undefined whether or not that duplication will survive in the
3862result list. The order of elements in the result list is also 3849result list. The order of elements in the result list is also
@@ -3871,7 +3858,7 @@ it tries to reuse the storage of the argument lists if possible.
3871@defun cl-intersection list1 list2 @t{&key :test :test-not :key} 3858@defun cl-intersection list1 list2 @t{&key :test :test-not :key}
3872This function computes the intersection of the sets represented 3859This function computes the intersection of the sets represented
3873by @var{list1} and @var{list2}. It returns the list of items 3860by @var{list1} and @var{list2}. It returns the list of items
3874which appear in both @var{list1} and @var{list2}. 3861that appear in both @var{list1} and @var{list2}.
3875@end defun 3862@end defun
3876 3863
3877@defun cl-nintersection list1 list2 @t{&key :test :test-not :key} 3864@defun cl-nintersection list1 list2 @t{&key :test :test-not :key}
@@ -3921,7 +3908,7 @@ This function searches the association list @var{a-list} for an
3921element whose @sc{car} matches (in the sense of @code{:test}, 3908element whose @sc{car} matches (in the sense of @code{:test},
3922@code{:test-not}, and @code{:key}, or by comparison with @code{eql}) 3909@code{:test-not}, and @code{:key}, or by comparison with @code{eql})
3923a given @var{item}. It returns the matching element, if any, 3910a given @var{item}. It returns the matching element, if any,
3924otherwise @code{nil}. It ignores elements of @var{a-list} which 3911otherwise @code{nil}. It ignores elements of @var{a-list} that
3925are not cons cells. (This corresponds to the behavior of 3912are not cons cells. (This corresponds to the behavior of
3926@code{assq} and @code{assoc} in Emacs Lisp; Common Lisp's 3913@code{assq} and @code{assoc} in Emacs Lisp; Common Lisp's
3927@code{assoc} ignores @code{nil}s but considers any other non-cons 3914@code{assoc} ignores @code{nil}s but considers any other non-cons
@@ -3982,11 +3969,11 @@ are symbols. For example,
3982@end example 3969@end example
3983 3970
3984@noindent 3971@noindent
3985defines a struct type called @code{person} which contains three 3972defines a struct type called @code{person} that contains three
3986slots. Given a @code{person} object @var{p}, you can access those 3973slots. Given a @code{person} object @var{p}, you can access those
3987slots by calling @code{(person-name @var{p})}, @code{(person-age @var{p})}, 3974slots by calling @code{(person-name @var{p})}, @code{(person-age @var{p})},
3988and @code{(person-sex @var{p})}. You can also change these slots by 3975and @code{(person-sex @var{p})}. You can also change these slots by
3989using @code{setf} on any of these place forms: 3976using @code{setf} on any of these place forms, for example:
3990 3977
3991@example 3978@example
3992(cl-incf (person-age birthday-boy)) 3979(cl-incf (person-age birthday-boy))
@@ -4003,10 +3990,10 @@ Given a @code{person}, @code{(copy-person @var{p})} makes a new
4003object of the same type whose slots are @code{eq} to those of @var{p}. 3990object of the same type whose slots are @code{eq} to those of @var{p}.
4004 3991
4005Given any Lisp object @var{x}, @code{(person-p @var{x})} returns 3992Given any Lisp object @var{x}, @code{(person-p @var{x})} returns
4006true if @var{x} looks like a @code{person}, false otherwise. (Again, 3993true if @var{x} looks like a @code{person}, and false otherwise. (Again,
4007in Common Lisp this predicate would be exact; in Emacs Lisp the 3994in Common Lisp this predicate would be exact; in Emacs Lisp the
4008best it can do is verify that @var{x} is a vector of the correct 3995best it can do is verify that @var{x} is a vector of the correct
4009length which starts with the correct tag symbol.) 3996length that starts with the correct tag symbol.)
4010 3997
4011Accessors like @code{person-name} normally check their arguments 3998Accessors like @code{person-name} normally check their arguments
4012(effectively using @code{person-p}) and signal an error if the 3999(effectively using @code{person-p}) and signal an error if the
@@ -4043,7 +4030,7 @@ In general, @var{name} is either a name symbol or a list of a name
4043symbol followed by any number of @dfn{struct options}; each @var{slot} 4030symbol followed by any number of @dfn{struct options}; each @var{slot}
4044is either a slot symbol or a list of the form @samp{(@var{slot-name} 4031is either a slot symbol or a list of the form @samp{(@var{slot-name}
4045@var{default-value} @var{slot-options}@dots{})}. The @var{default-value} 4032@var{default-value} @var{slot-options}@dots{})}. The @var{default-value}
4046is a Lisp form which is evaluated any time an instance of the 4033is a Lisp form that is evaluated any time an instance of the
4047structure type is created without specifying that slot's value. 4034structure type is created without specifying that slot's value.
4048 4035
4049Common Lisp defines several slot options, but the only one 4036Common Lisp defines several slot options, but the only one
@@ -4101,11 +4088,11 @@ The argument names should match the slot names; each slot is
4101initialized from the corresponding argument. Slots whose names 4088initialized from the corresponding argument. Slots whose names
4102do not appear in the argument list are initialized based on the 4089do not appear in the argument list are initialized based on the
4103@var{default-value} in their slot descriptor. Also, @code{&optional} 4090@var{default-value} in their slot descriptor. Also, @code{&optional}
4104and @code{&key} arguments which don't specify defaults take their 4091and @code{&key} arguments that don't specify defaults take their
4105defaults from the slot descriptor. It is valid to include arguments 4092defaults from the slot descriptor. It is valid to include arguments
4106which don't correspond to slot names; these are useful if they are 4093that don't correspond to slot names; these are useful if they are
4107referred to in the defaults for optional, keyword, or @code{&aux} 4094referred to in the defaults for optional, keyword, or @code{&aux}
4108arguments which @emph{do} correspond to slots. 4095arguments that @emph{do} correspond to slots.
4109 4096
4110You can specify any number of full-format @code{:constructor} 4097You can specify any number of full-format @code{:constructor}
4111options on a structure. The default constructor is still generated 4098options on a structure. The default constructor is still generated
@@ -4146,7 +4133,7 @@ means not to generate a copier function. (In this implementation,
4146all copier functions are simply synonyms for @code{copy-sequence}.) 4133all copier functions are simply synonyms for @code{copy-sequence}.)
4147 4134
4148@item :predicate 4135@item :predicate
4149The argument is an alternate name for the predicate which recognizes 4136The argument is an alternate name for the predicate that recognizes
4150objects of this type. The default is @code{@var{name}-p}. @code{nil} 4137objects of this type. The default is @code{@var{name}-p}. @code{nil}
4151means not to generate a predicate function. (If the @code{:type} 4138means not to generate a predicate function. (If the @code{:type}
4152option is used without the @code{:named} option, no predicate is 4139option is used without the @code{:named} option, no predicate is
@@ -4206,7 +4193,7 @@ work on astronauts just like other people.
4206 4193
4207@item :print-function 4194@item :print-function
4208In full Common Lisp, this option allows you to specify a function 4195In full Common Lisp, this option allows you to specify a function
4209which is called to print an instance of the structure type. The 4196that is called to print an instance of the structure type. The
4210Emacs Lisp system offers no hooks into the Lisp printer which would 4197Emacs Lisp system offers no hooks into the Lisp printer which would
4211allow for such a feature, so this package simply ignores 4198allow for such a feature, so this package simply ignores
4212@code{:print-function}. 4199@code{:print-function}.
@@ -4383,7 +4370,7 @@ You can find out how a macro expands by using the
4383This function takes a single Lisp form as an argument and inserts 4370This function takes a single Lisp form as an argument and inserts
4384a nicely formatted copy of it in the current buffer (which must be 4371a nicely formatted copy of it in the current buffer (which must be
4385in Lisp mode so that indentation works properly). It also expands 4372in Lisp mode so that indentation works properly). It also expands
4386all Lisp macros which appear in the form. The easiest way to use 4373all Lisp macros that appear in the form. The easiest way to use
4387this function is to go to the @file{*scratch*} buffer and type, say, 4374this function is to go to the @file{*scratch*} buffer and type, say,
4388 4375
4389@example 4376@example
@@ -4392,7 +4379,7 @@ this function is to go to the @file{*scratch*} buffer and type, say,
4392 4379
4393@noindent 4380@noindent
4394and type @kbd{C-x C-e} immediately after the closing parenthesis; 4381and type @kbd{C-x C-e} immediately after the closing parenthesis;
4395the expansion 4382an expansion similar to:
4396 4383
4397@example 4384@example
4398(cl-block nil 4385(cl-block nil
@@ -4413,7 +4400,11 @@ variable @code{G1004} was created by @code{cl-gensym}.)
4413If the optional argument @var{full} is true, then @emph{all} 4400If the optional argument @var{full} is true, then @emph{all}
4414macros are expanded, including @code{cl-block}, @code{cl-eval-when}, 4401macros are expanded, including @code{cl-block}, @code{cl-eval-when},
4415and compiler macros. Expansion is done as if @var{form} were 4402and compiler macros. Expansion is done as if @var{form} were
4416a top-level form in a file being compiled. For example, 4403a top-level form in a file being compiled.
4404
4405@c FIXME none of these examples are still applicable.
4406@ignore
4407For example,
4417 4408
4418@example 4409@example
4419(cl-prettyexpand '(cl-pushnew 'x list)) 4410(cl-prettyexpand '(cl-pushnew 'x list))
@@ -4423,16 +4414,12 @@ a top-level form in a file being compiled. For example,
4423(cl-prettyexpand '(caddr (cl-member 'a list)) t) 4414(cl-prettyexpand '(caddr (cl-member 'a list)) t)
4424 @print{} (car (cdr (cdr (memq 'a list)))) 4415 @print{} (car (cdr (cdr (memq 'a list))))
4425@end example 4416@end example
4417@end ignore
4426 4418
4427Note that @code{cl-adjoin}, @code{cl-caddr}, and @code{cl-member} all 4419Note that @code{cl-adjoin}, @code{cl-caddr}, and @code{cl-member} all
4428have built-in compiler macros to optimize them in common cases. 4420have built-in compiler macros to optimize them in common cases.
4429@end defun 4421@end defun
4430 4422
4431@ifinfo
4432@example
4433
4434@end example
4435@end ifinfo
4436@appendixsec Error Checking 4423@appendixsec Error Checking
4437 4424
4438@noindent 4425@noindent
@@ -4442,7 +4429,7 @@ where substantial gains were possible at the expense of marginal
4442incompatibility. 4429incompatibility.
4443 4430
4444The Common Lisp standard (as embodied in Steele's book) uses the 4431The Common Lisp standard (as embodied in Steele's book) uses the
4445phrase ``it is an error if'' to indicate a situation which is not 4432phrase ``it is an error if'' to indicate a situation that is not
4446supposed to arise in complying programs; implementations are strongly 4433supposed to arise in complying programs; implementations are strongly
4447encouraged but not required to signal an error in these situations. 4434encouraged but not required to signal an error in these situations.
4448This package sometimes omits such error checking in the interest of 4435This package sometimes omits such error checking in the interest of
@@ -4464,45 +4451,43 @@ you can use @code{&allow-other-keys} to omit this check. Functions
4464defined in this package such as @code{cl-find} and @code{cl-member} 4451defined in this package such as @code{cl-find} and @code{cl-member}
4465do check their keyword arguments for validity. 4452do check their keyword arguments for validity.
4466 4453
4467@ifinfo 4454@appendixsec Compiler Optimizations
4468@example
4469
4470@end example
4471@end ifinfo
4472@appendixsec Optimizing Compiler
4473 4455
4474@noindent 4456@noindent
4475Use of the optimizing Emacs compiler is highly recommended; many of the Common 4457Changing the value of @code{byte-optimize} from the default @code{t}
4458is highly discouraged; many of the Common
4476Lisp macros emit 4459Lisp macros emit
4477code which can be improved by optimization. In particular, 4460code that can be improved by optimization. In particular,
4478@code{cl-block}s (whether explicit or implicit in constructs like 4461@code{cl-block}s (whether explicit or implicit in constructs like
4479@code{cl-defun} and @code{cl-loop}) carry a fair run-time penalty; the 4462@code{cl-defun} and @code{cl-loop}) carry a fair run-time penalty; the
4480optimizing compiler removes @code{cl-block}s which are not actually 4463byte-compiler removes @code{cl-block}s that are not actually
4481referenced by @code{cl-return} or @code{cl-return-from} inside the block. 4464referenced by @code{cl-return} or @code{cl-return-from} inside the block.
4482 4465
4483@node Common Lisp Compatibility 4466@node Common Lisp Compatibility
4484@appendix Common Lisp Compatibility 4467@appendix Common Lisp Compatibility
4485 4468
4486@noindent 4469@noindent
4487Following is a list of all known incompatibilities between this 4470The following is a list of all known incompatibilities between this
4488package and Common Lisp as documented in Steele (2nd edition). 4471package and Common Lisp as documented in Steele (2nd edition).
4489 4472
4490The word @code{cl-defun} is required instead of @code{defun} in order 4473The word @code{cl-defun} is required instead of @code{defun} in order
4491to use extended Common Lisp argument lists in a function. Likewise, 4474to use extended Common Lisp argument lists in a function. Likewise,
4492@code{cl-defmacro} and @code{cl-function} are versions of those forms 4475@code{cl-defmacro} and @code{cl-function} are versions of those forms
4493which understand full-featured argument lists. The @code{&whole} 4476which understand full-featured argument lists. The @code{&whole}
4494keyword does not work in @code{defmacro} argument lists (except 4477keyword does not work in @code{cl-defmacro} argument lists (except
4495inside recursive argument lists). 4478inside recursive argument lists).
4496 4479
4497The @code{equal} predicate does not distinguish 4480The @code{equal} predicate does not distinguish
4498between IEEE floating-point plus and minus zero. The @code{cl-equalp} 4481between IEEE floating-point plus and minus zero. The @code{cl-equalp}
4499predicate has several differences with Common Lisp; @pxref{Predicates}. 4482predicate has several differences with Common Lisp; @pxref{Predicates}.
4500 4483
4501@c FIXME no longer provided by cl. 4484@c FIXME consider moving to lispref
4485@ignore
4502The @code{setf} mechanism is entirely compatible, except that 4486The @code{setf} mechanism is entirely compatible, except that
4503setf-methods return a list of five values rather than five 4487setf-methods return a list of five values rather than five
4504values directly. Also, the new ``@code{setf} function'' concept 4488values directly. Also, the new ``@code{setf} function'' concept
4505(typified by @code{(defun (setf foo) @dots{})}) is not implemented. 4489(typified by @code{(defun (setf foo) @dots{})}) is not implemented.
4490@end ignore
4506 4491
4507The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols} 4492The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols}
4508with no @var{obarray} argument. In Common Lisp, this form would 4493with no @var{obarray} argument. In Common Lisp, this form would
@@ -4635,7 +4620,7 @@ However, the Emacs parser does not understand colons and just
4635treats them as part of the symbol name. Thus, while @code{mapcar} 4620treats them as part of the symbol name. Thus, while @code{mapcar}
4636and @code{lisp:mapcar} may refer to the same symbol in Common 4621and @code{lisp:mapcar} may refer to the same symbol in Common
4637Lisp, they are totally distinct in Emacs Lisp. Common Lisp 4622Lisp, they are totally distinct in Emacs Lisp. Common Lisp
4638programs which refer to a symbol by the full name sometimes 4623programs that refer to a symbol by the full name sometimes
4639and the short name other times will not port cleanly to Emacs. 4624and the short name other times will not port cleanly to Emacs.
4640 4625
4641Emacs Lisp does have a concept of ``obarrays'', which are 4626Emacs Lisp does have a concept of ``obarrays'', which are
@@ -4922,8 +4907,9 @@ Common Lisp defines three macros, @code{define-modify-macro},
4922@code{defsetf}, and @code{define-setf-method}, that allow the 4907@code{defsetf}, and @code{define-setf-method}, that allow the
4923user to extend generalized variables in various ways. 4908user to extend generalized variables in various ways.
4924In Emacs, these are obsolete, replaced by various features of 4909In Emacs, these are obsolete, replaced by various features of
4925@file{gv.el} in Emacs 24.3. 4910@file{gv.el} in Emacs 24.3. Many of the implementation
4926@c FIXME details. 4911details in the following are out-of-date.
4912@c FIXME this whole section needs updating.
4927 4913
4928@defmac define-modify-macro name arglist function [doc-string] 4914@defmac define-modify-macro name arglist function [doc-string]
4929This macro defines a ``read-modify-write'' macro similar to 4915This macro defines a ``read-modify-write'' macro similar to
@@ -4992,7 +4978,7 @@ Otherwise, the above expansion would not obey the rules for the way
4992@code{setf} is supposed to behave. 4978@code{setf} is supposed to behave.
4993 4979
4994As a special (non-Common-Lisp) extension, a third argument of @code{t} 4980As a special (non-Common-Lisp) extension, a third argument of @code{t}
4995to @code{defsetf} says that the @code{update-fn}'s return value is 4981to @code{defsetf} says that the return value of @code{update-fn} is
4996not suitable, so that the above @code{setf} should be expanded to 4982not suitable, so that the above @code{setf} should be expanded to
4997something more like 4983something more like
4998 4984
@@ -5015,7 +5001,7 @@ suite of setf methods, are:
5015@defmac defsetf access-fn arglist (store-var) forms@dots{} 5001@defmac defsetf access-fn arglist (store-var) forms@dots{}
5016This is the second, more complex, form of @code{defsetf}. It is 5002This is the second, more complex, form of @code{defsetf}. It is
5017rather like @code{defmacro} except for the additional @var{store-var} 5003rather like @code{defmacro} except for the additional @var{store-var}
5018argument. The @var{forms} should return a Lisp form which stores 5004argument. The @var{forms} should return a Lisp form that stores
5019the value of @var{store-var} into the generalized variable formed 5005the value of @var{store-var} into the generalized variable formed
5020by a call to @var{access-fn} with arguments described by @var{arglist}. 5006by a call to @var{access-fn} with arguments described by @var{arglist}.
5021The @var{forms} may begin with a string which documents the @code{setf} 5007The @var{forms} may begin with a string which documents the @code{setf}
@@ -5031,7 +5017,7 @@ For example, the simple form of @code{defsetf} is shorthand for
5031 5017
5032The Lisp form that is returned can access the arguments from 5018The Lisp form that is returned can access the arguments from
5033@var{arglist} and @var{store-var} in an unrestricted fashion; 5019@var{arglist} and @var{store-var} in an unrestricted fashion;
5034macros like @code{setf} and @code{cl-incf} which invoke this 5020macros like @code{cl-incf} that invoke this
5035setf-method will insert temporary variables as needed to make 5021setf-method will insert temporary variables as needed to make
5036sure the apparent order of evaluation is preserved. 5022sure the apparent order of evaluation is preserved.
5037 5023
@@ -5048,6 +5034,7 @@ This is the most general way to create new place forms. When
5048a @code{setf} to @var{access-fn} with arguments described by 5034a @code{setf} to @var{access-fn} with arguments described by
5049@var{arglist} is expanded, the @var{forms} are evaluated and 5035@var{arglist} is expanded, the @var{forms} are evaluated and
5050must return a list of five items: 5036must return a list of five items:
5037@c FIXME Is this still true?
5051 5038
5052@enumerate 5039@enumerate
5053@item 5040@item
@@ -5063,12 +5050,12 @@ A list of exactly one @dfn{store variable} (generally obtained
5063from a call to @code{gensym}). 5050from a call to @code{gensym}).
5064 5051
5065@item 5052@item
5066A Lisp form which stores the contents of the store variable into 5053A Lisp form that stores the contents of the store variable into
5067the generalized variable, assuming the temporaries have been 5054the generalized variable, assuming the temporaries have been
5068bound as described above. 5055bound as described above.
5069 5056
5070@item 5057@item
5071A Lisp form which accesses the contents of the generalized variable, 5058A Lisp form that accesses the contents of the generalized variable,
5072assuming the temporaries have been bound. 5059assuming the temporaries have been bound.
5073@end enumerate 5060@end enumerate
5074 5061
@@ -5084,7 +5071,8 @@ temporary variables. In the setf-methods generated by
5084@code{defsetf}, the second return value is simply the list of 5071@code{defsetf}, the second return value is simply the list of
5085arguments in the place form, and the first return value is a 5072arguments in the place form, and the first return value is a
5086list of a corresponding number of temporary variables generated 5073list of a corresponding number of temporary variables generated
5087by @code{cl-gensym}. Macros like @code{setf} and @code{cl-incf} which 5074@c FIXME I don't think this is true anymore.
5075by @code{cl-gensym}. Macros like @code{cl-incf} that
5088use this setf-method will optimize away most temporaries that 5076use this setf-method will optimize away most temporaries that
5089turn out to be unnecessary, so there is little reason for the 5077turn out to be unnecessary, so there is little reason for the
5090setf-method itself to optimize. 5078setf-method itself to optimize.
@@ -5095,12 +5083,14 @@ This function returns the setf-method for @var{place}, by
5095invoking the definition previously recorded by @code{defsetf} 5083invoking the definition previously recorded by @code{defsetf}
5096or @code{define-setf-method}. The result is a list of five 5084or @code{define-setf-method}. The result is a list of five
5097values as described above. You can use this function to build 5085values as described above. You can use this function to build
5098your own @code{cl-incf}-like modify macros. (Actually, it is 5086your own @code{cl-incf}-like modify macros.
5099@c FIXME? 5087@c These no longer exist.
5100better to use the internal functions @code{cl-setf-do-modify} 5088@ignore
5101and @code{cl-setf-do-store}, which are a bit easier to use and 5089(Actually, it is better to use the internal functions
5102which also do a number of optimizations; consult the source 5090@code{cl-setf-do-modify} and @code{cl-setf-do-store}, which are a bit
5103code for the @code{cl-incf} function for a simple example.) 5091easier to use and which also do a number of optimizations; consult the
5092source code for the @code{cl-incf} function for a simple example.)
5093@end ignore
5104 5094
5105The argument @var{env} specifies the ``environment'' to be 5095The argument @var{env} specifies the ``environment'' to be
5106passed on to @code{macroexpand} if @code{get-setf-method} should 5096passed on to @code{macroexpand} if @code{get-setf-method} should
@@ -5108,12 +5098,14 @@ need to expand a macro in @var{place}. It should come from
5108an @code{&environment} argument to the macro or setf-method 5098an @code{&environment} argument to the macro or setf-method
5109that called @code{get-setf-method}. 5099that called @code{get-setf-method}.
5110 5100
5101@c FIXME No longer true.
5111See also the source code for the setf-method for 5102See also the source code for the setf-method for
5112@c Also @code{apply}, but that is commented out. 5103@c Also @code{apply}, but that is commented out.
5113@code{substring}, which works by calling @code{get-setf-method} on a 5104@code{substring}, which works by calling @code{get-setf-method} on a
5114simpler case, then massaging the result. 5105simpler case, then massaging the result.
5115@end defun 5106@end defun
5116 5107
5108@c FIXME does not belong here any more, maybe in lispref?
5117Modern Common Lisp defines a second, independent way to specify 5109Modern Common Lisp defines a second, independent way to specify
5118the @code{setf} behavior of a function, namely ``@code{setf} 5110the @code{setf} behavior of a function, namely ``@code{setf}
5119functions'' whose names are lists @code{(setf @var{name})} 5111functions'' whose names are lists @code{(setf @var{name})}