aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorGlenn Morris2012-10-31 21:44:50 -0400
committerGlenn Morris2012-10-31 21:44:50 -0400
commitdf43dd5361372fffb5d1618228a9c6a55db96169 (patch)
tree721d49c00d91ca0fed4880a223594afc6a3ed881 /doc/misc
parent87b0d8b1d1ca858c76afa23e4a936bdd9fd8c2e1 (diff)
downloademacs-df43dd5361372fffb5d1618228a9c6a55db96169.tar.gz
emacs-df43dd5361372fffb5d1618228a9c6a55db96169.zip
* doc/misc/cl.texi: General copyedits for style, line-breaks, etc.
Replace "..." by @dots; car by @sc{car}, etc.
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/ChangeLog4
-rw-r--r--doc/misc/cl.texi235
2 files changed, 123 insertions, 116 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 29d8792ce6b..38dcdf507c4 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,7 @@
12012-11-01 Glenn Morris <rgm@gnu.org>
2
3 * cl.texi: General copyedits for style, line-breaks, etc.
4
12012-10-31 Glenn Morris <rgm@gnu.org> 52012-10-31 Glenn Morris <rgm@gnu.org>
2 6
3 * ert.texi (Introduction, The @code{should} Macro): 7 * ert.texi (Introduction, The @code{should} Macro):
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index d0ca78e55ee..392ee61be51 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -54,27 +54,29 @@ developing GNU and promoting software freedom.''
54@end ifnottex 54@end ifnottex
55 55
56@menu 56@menu
57* Overview:: Basics, usage, etc. 57* Overview:: Basics, usage, organization, naming conventions.
58* Program Structure:: Arglists, @code{cl-eval-when}, @code{defalias}. 58* Program Structure:: Arglists, @code{cl-eval-when}.
59* Predicates:: @code{cl-typep} and @code{cl-equalp}. 59* Predicates:: Type predicates and equality predicates.
60* Control Structure:: @code{cl-do}, @code{cl-loop}, etc. 60* Control Structure:: Assignment, conditionals, blocks, looping.
61* Macros:: Destructuring, @code{cl-define-compiler-macro}. 61* Macros:: Destructuring, compiler macros.
62* Declarations:: @code{cl-proclaim}, @code{cl-declare}, etc. 62* Declarations:: @code{cl-proclaim}, @code{cl-declare}, etc.
63* Symbols:: Property lists, @code{cl-gensym}. 63* Symbols:: Property lists, creating symbols.
64* Numbers:: Predicates, functions, random numbers. 64* Numbers:: Predicates, functions, random numbers.
65* Sequences:: Mapping, functions, searching, sorting. 65* Sequences:: Mapping, functions, searching, sorting.
66* Lists:: @code{cl-caddr}, @code{cl-sublis}, @code{cl-member}, @code{cl-assoc}, etc. 66* Lists:: Functions, substitution, sets, associations.
67* Structures:: @code{cl-defstruct}. 67* Structures:: @code{cl-defstruct}.
68* Assertions:: @code{cl-check-type}, @code{cl-assert}. 68* Assertions:: Assertions and type checking.
69
70* Efficiency Concerns:: Hints and techniques.
71* Common Lisp Compatibility:: All known differences with Steele.
72* Porting Common Lisp:: Hints for porting Common Lisp code.
73* Obsolete Features:: Obsolete features.
74 69
70Appendices
71* Efficiency Concerns:: Hints and techniques.
72* Common Lisp Compatibility:: All known differences with Steele.
73* Porting Common Lisp:: Hints for porting Common Lisp code.
74* Obsolete Features:: Obsolete features.
75* GNU Free Documentation License:: The license for this documentation. 75* GNU Free Documentation License:: The license for this documentation.
76* Function Index:: 76
77* Variable Index:: 77Indexes
78* Function Index:: An entry for each documented function.
79* Variable Index:: An entry for each documented variable.
78@end menu 80@end menu
79 81
80@node Overview 82@node Overview
@@ -93,9 +95,9 @@ As Emacs Lisp programmers have grown in number, and the applications
93they write have grown more ambitious, it has become clear that Emacs 95they write have grown more ambitious, it has become clear that Emacs
94Lisp could benefit from many of the conveniences of Common Lisp. 96Lisp could benefit from many of the conveniences of Common Lisp.
95 97
96The @code{CL} package adds a number of Common Lisp functions and 98The @dfn{CL} package adds a number of Common Lisp functions and
97control structures to Emacs Lisp. While not a 100% complete 99control structures to Emacs Lisp. While not a 100% complete
98implementation of Common Lisp, @code{CL} adds enough functionality 100implementation of Common Lisp, it adds enough functionality
99to make Emacs Lisp programming significantly more convenient. 101to make Emacs Lisp programming significantly more convenient.
100 102
101Some Common Lisp features have been omitted from this package 103Some Common Lisp features have been omitted from this package
@@ -111,8 +113,7 @@ examples of this group.
111Other features cannot be implemented without modification to the 113Other features cannot be implemented without modification to the
112Emacs Lisp interpreter itself, such as multiple return values, 114Emacs Lisp interpreter itself, such as multiple return values,
113case-insensitive symbols, and complex numbers. 115case-insensitive symbols, and complex numbers.
114The @code{CL} package generally makes no attempt to emulate these 116This package generally makes no attempt to emulate these features.
115features.
116 117
117@end itemize 118@end itemize
118 119
@@ -124,18 +125,18 @@ impact on the rest of the Emacs environment. Stefan Monnier added the
124file @file{cl-lib.el} and rationalized the namespace for Emacs 24.3. 125file @file{cl-lib.el} and rationalized the namespace for Emacs 24.3.
125 126
126@menu 127@menu
127* Usage:: How to use the CL package. 128* Usage:: How to use this package.
128* Organization:: The package's component files. 129* Organization:: The package's component files.
129* Naming Conventions:: Notes on CL function names. 130* Naming Conventions:: Notes on function names.
130@end menu 131@end menu
131 132
132@node Usage 133@node Usage
133@section Usage 134@section Usage
134 135
135@noindent 136@noindent
136The @code{CL} package is distributed with Emacs, so there is no need 137This package is distributed with Emacs, so there is no need
137to install any additional files in order to start using it. Lisp code 138to install any additional files in order to start using it. Lisp code
138that uses features from the @code{CL} package should simply include at 139that uses features from this package should simply include at
139the beginning: 140the beginning:
140 141
141@example 142@example
@@ -144,7 +145,7 @@ the beginning:
144 145
145@noindent 146@noindent
146You may wish to add such a statement to your init file, if you 147You may wish to add such a statement to your init file, if you
147make frequent use of CL features. 148make frequent use of features from this package.
148 149
149@node Organization 150@node Organization
150@section Organization 151@section Organization
@@ -183,17 +184,17 @@ will take care of pulling in the other files when they are
183needed. 184needed.
184 185
185There is another file, @file{cl.el}, which was the main entry point to 186There is another file, @file{cl.el}, which was the main entry point to
186the CL package prior to Emacs 24.3. Nowadays, it is replaced by 187this package prior to Emacs 24.3. Nowadays, it is replaced by
187@file{cl-lib.el}. The two provide the same features (in most cases), 188@file{cl-lib.el}. The two provide the same features (in most cases),
188but use different function names (in fact, @file{cl.el} mainly just 189but use different function names (in fact, @file{cl.el} mainly just
189defines aliases to the @file{cl-lib.el} definitions). Where 190defines aliases to the @file{cl-lib.el} definitions). Where
190@file{cl-lib.el} defines a function called, for example, 191@file{cl-lib.el} defines a function called, for example,
191@code{cl-incf}, @file{cl.el} uses the same name but without the 192@code{cl-incf}, @file{cl.el} uses the same name but without the
192@samp{cl-} prefix, e.g. @code{incf} in this example. There are a few 193@samp{cl-} prefix, e.g.@: @code{incf} in this example. There are a few
193exceptions to this. First, functions such as @code{cl-defun} where 194exceptions to this. First, functions such as @code{cl-defun} where
194the unprefixed version was already used for a standard Emacs Lisp 195the unprefixed version was already used for a standard Emacs Lisp
195function. In such cases, the @file{cl.el} version adds a @samp{*} 196function. In such cases, the @file{cl.el} version adds a @samp{*}
196suffix, e.g. @code{defun*}. Second, there are some obsolete features 197suffix, e.g.@: @code{defun*}. Second, there are some obsolete features
197that are only implemented in @file{cl.el}, not in @file{cl-lib.el}, 198that are only implemented in @file{cl.el}, not in @file{cl-lib.el},
198because they are replaced by other standard Emacs Lisp features. 199because they are replaced by other standard Emacs Lisp features.
199Finally, in a very few cases the old @file{cl.el} versions do not 200Finally, in a very few cases the old @file{cl.el} versions do not
@@ -210,7 +211,7 @@ There is no such restriction on the use of @code{cl-lib}. New code
210should use @code{cl-lib} rather than @code{cl}. 211should use @code{cl-lib} rather than @code{cl}.
211 212
212There is one more file, @file{cl-compat.el}, which defines some 213There is one more file, @file{cl-compat.el}, which defines some
213routines from the older Quiroz CL package that are not otherwise 214routines from the older Quiroz @file{cl.el} package that are not otherwise
214present in the new package. This file is obsolete and should not be 215present in the new package. This file is obsolete and should not be
215used in new code. 216used in new code.
216 217
@@ -224,42 +225,44 @@ names that are those of Common Lisp plus a @samp{cl-} prefix.
224 225
225Internal function and variable names in the package are prefixed 226Internal function and variable names in the package are prefixed
226by @code{cl--}. Here is a complete list of functions prefixed by 227by @code{cl--}. Here is a complete list of functions prefixed by
227@code{cl-} that were not taken from Common Lisp: 228@code{cl-} that were @emph{not} taken from Common Lisp:
228 229
229@example 230@example
230cl-callf cl-callf2 cl-defsubst 231cl-callf cl-callf2 cl-defsubst
231cl-floatp-safe cl-letf cl-letf* 232cl-floatp-safe cl-letf cl-letf*
232@end example 233@end example
233 234
235@c This is not uninteresting I suppose, but is of zero practical relevance
236@c to the user, and seems like a hostage to changing implementation details.
234The following simple functions and macros are defined in @file{cl-lib.el}; 237The following simple functions and macros are defined in @file{cl-lib.el};
235they do not cause other components like @file{cl-extra} to be loaded. 238they do not cause other components like @file{cl-extra} to be loaded.
236 239
237@example 240@example
238cl-floatp-safe cl-endp 241cl-evenp cl-oddp cl-minusp
239cl-evenp cl-oddp cl-plusp cl-minusp 242cl-plusp cl-floatp-safe cl-endp
240cl-caaar .. cl-cddddr 243cl-copy-list cl-list* cl-ldiff
241cl-list* cl-ldiff cl-rest cl-first .. cl-tenth 244cl-rest cl-decf [1] cl-incf [1]
242cl-copy-list cl-subst cl-mapcar [2] 245cl-acons cl-adjoin [2] cl-pairlis
243cl-adjoin [3] cl-acons cl-pairlis 246cl-pushnew [1,2] cl-declaim cl-proclaim
244cl-pushnew [3,4] cl-incf [4] cl-decf [4] 247cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth
245cl-proclaim cl-declaim 248cl-subst cl-mapcar [3]
246@end example 249@end example
247 250
248@noindent 251@noindent
249[2] Only for one sequence argument or two list arguments. 252[1] Only when @var{place} is a plain variable name.
250 253
251@noindent 254@noindent
252[3] Only if @code{:test} is @code{eq}, @code{equal}, or unspecified, 255[2] Only if @code{:test} is @code{eq}, @code{equal}, or unspecified,
253and @code{:key} is not used. 256and @code{:key} is not used.
254 257
255@noindent 258@noindent
256[4] Only when @var{place} is a plain variable name. 259[3] Only for one sequence argument or two list arguments.
257 260
258@node Program Structure 261@node Program Structure
259@chapter Program Structure 262@chapter Program Structure
260 263
261@noindent 264@noindent
262This section describes features of the @code{CL} package that have to 265This section describes features of this package that have to
263do with programs as a whole: advanced argument lists for functions, 266do with programs as a whole: advanced argument lists for functions,
264and the @code{cl-eval-when} construct. 267and the @code{cl-eval-when} construct.
265 268
@@ -283,14 +286,14 @@ this package to implement Common Lisp argument lists seamlessly.
283Instead, this package defines alternates for several Lisp forms 286Instead, this package defines alternates for several Lisp forms
284which you must use if you need Common Lisp argument lists. 287which you must use if you need Common Lisp argument lists.
285 288
286@defmac cl-defun name arglist body... 289@defmac cl-defun name arglist body@dots{}
287This form is identical to the regular @code{defun} form, except 290This form is identical to the regular @code{defun} form, except
288that @var{arglist} is allowed to be a full Common Lisp argument 291that @var{arglist} is allowed to be a full Common Lisp argument
289list. Also, the function body is enclosed in an implicit block 292list. Also, the function body is enclosed in an implicit block
290called @var{name}; @pxref{Blocks and Exits}. 293called @var{name}; @pxref{Blocks and Exits}.
291@end defmac 294@end defmac
292 295
293@defmac cl-defsubst name arglist body... 296@defmac cl-defsubst name arglist body@dots{}
294This is just like @code{cl-defun}, except that the function that 297This is just like @code{cl-defun}, except that the function that
295is defined is automatically proclaimed @code{inline}, i.e., 298is defined is automatically proclaimed @code{inline}, i.e.,
296calls to it may be expanded into in-line code by the byte compiler. 299calls to it may be expanded into in-line code by the byte compiler.
@@ -302,7 +305,7 @@ arranges for the processing of keyword arguments, default values,
302etc., to be done at compile-time whenever possible. 305etc., to be done at compile-time whenever possible.
303@end defmac 306@end defmac
304 307
305@defmac cl-defmacro name arglist body... 308@defmac cl-defmacro name arglist body@dots{}
306This is identical to the regular @code{defmacro} form, 309This is identical to the regular @code{defmacro} form,
307except that @var{arglist} is allowed to be a full Common Lisp 310except that @var{arglist} is allowed to be a full Common Lisp
308argument list. The @code{&environment} keyword is supported as 311argument list. The @code{&environment} keyword is supported as
@@ -324,7 +327,7 @@ in this package that include @var{arglist}s in their syntax allow
324full Common Lisp argument lists. 327full Common Lisp argument lists.
325 328
326Note that it is @emph{not} necessary to use @code{cl-defun} in 329Note that it is @emph{not} necessary to use @code{cl-defun} in
327order to have access to most @code{CL} features in your function. 330order to have access to most CL features in your function.
328These features are always present; @code{cl-defun}'s only 331These features are always present; @code{cl-defun}'s only
329difference from @code{defun} is its more flexible argument 332difference from @code{defun} is its more flexible argument
330lists and its implicit block. 333lists and its implicit block.
@@ -332,11 +335,11 @@ lists and its implicit block.
332The full form of a Common Lisp argument list is 335The full form of a Common Lisp argument list is
333 336
334@example 337@example
335(@var{var}... 338(@var{var}@dots{}
336 &optional (@var{var} @var{initform} @var{svar})... 339 &optional (@var{var} @var{initform} @var{svar})@dots{}
337 &rest @var{var} 340 &rest @var{var}
338 &key ((@var{keyword} @var{var}) @var{initform} @var{svar})... 341 &key ((@var{keyword} @var{var}) @var{initform} @var{svar})@dots{}
339 &aux (@var{var} @var{initform})...) 342 &aux (@var{var} @var{initform})@dots{})
340@end example 343@end example
341 344
342Each of the five argument list sections is optional. The @var{svar}, 345Each of the five argument list sections is optional. The @var{svar},
@@ -426,11 +429,11 @@ function uses both @code{&rest} and @code{&key} at the same time,
426the ``rest'' argument is bound to the keyword list as it appears 429the ``rest'' argument is bound to the keyword list as it appears
427in the call. For example: 430in the call. For example:
428 431
429@smallexample 432@example
430(cl-defun find-thing (thing &rest rest &key need &allow-other-keys) 433(cl-defun find-thing (thing &rest rest &key need &allow-other-keys)
431 (or (apply 'cl-member thing thing-list :allow-other-keys t rest) 434 (or (apply 'cl-member thing thing-list :allow-other-keys t rest)
432 (if need (error "Thing not found")))) 435 (if need (error "Thing not found"))))
433@end smallexample 436@end example
434 437
435@noindent 438@noindent
436This function takes a @code{:need} keyword argument, but also 439This function takes a @code{:need} keyword argument, but also
@@ -467,7 +470,7 @@ For example:
467@example 470@example
468(cl-defmacro dolist ((var listform &optional resultform) 471(cl-defmacro dolist ((var listform &optional resultform)
469 &rest body) 472 &rest body)
470 ...) 473 @dots{})
471@end example 474@end example
472 475
473This says that the first argument of @code{dolist} must be a list 476This says that the first argument of @code{dolist} must be a list
@@ -506,7 +509,7 @@ For example, the compiler effectively evaluates @code{defmacro} forms
506at compile-time so that later parts of the file can refer to the 509at compile-time so that later parts of the file can refer to the
507macros that are defined. 510macros that are defined.
508 511
509@defmac cl-eval-when (situations...) forms... 512@defmac cl-eval-when (situations@dots{}) forms@dots{}
510This form controls when the body @var{forms} are evaluated. 513This form controls when the body @var{forms} are evaluated.
511The @var{situations} list may contain any set of the symbols 514The @var{situations} list may contain any set of the symbols
512@code{compile}, @code{load}, and @code{eval} (or their long-winded 515@code{compile}, @code{load}, and @code{eval} (or their long-winded
@@ -588,7 +591,7 @@ The other form, @code{(eval-and-compile @dots{})}, is exactly
588equivalent to @samp{(cl-eval-when (compile load eval) @dots{})} and 591equivalent to @samp{(cl-eval-when (compile load eval) @dots{})} and
589so is not itself defined by this package. 592so is not itself defined by this package.
590 593
591@defmac eval-when-compile forms... 594@defmac eval-when-compile forms@dots{}
592The @var{forms} are evaluated at compile-time; at execution time, 595The @var{forms} are evaluated at compile-time; at execution time,
593this form acts like a quoted constant of the resulting value. Used 596this form acts like a quoted constant of the resulting value. Used
594at top-level, @code{eval-when-compile} is just like @samp{eval-when 597at top-level, @code{eval-when-compile} is just like @samp{eval-when
@@ -636,7 +639,7 @@ Byte-compiled, the above defun will result in the following code
636 (insert "This function was executed on: " 639 (insert "This function was executed on: "
637 (current-time-string) 640 (current-time-string)
638 ", compiled on: " 641 ", compiled on: "
639 '"Wed Jun 23 18:33:43 1993" 642 '"Wed Oct 31 16:32:28 2012"
640 ", and loaded on: " 643 ", and loaded on: "
641 --temp--)) 644 --temp--))
642@end example 645@end example
@@ -748,13 +751,13 @@ floats. In all other circumstances, @code{cl-coerce} signals an
748error. 751error.
749@end defun 752@end defun
750 753
751@defmac cl-deftype name arglist forms... 754@defmac cl-deftype name arglist forms@dots{}
752This macro defines a new type called @var{name}. It is similar 755This macro defines a new type called @var{name}. It is similar
753to @code{defmacro} in many ways; when @var{name} is encountered 756to @code{defmacro} in many ways; when @var{name} is encountered
754as a type name, the body @var{forms} are evaluated and should 757as a type name, the body @var{forms} are evaluated and should
755return a type specifier that is equivalent to the type. The 758return a type specifier that is equivalent to the type. The
756@var{arglist} is a Common Lisp argument list of the sort accepted 759@var{arglist} is a Common Lisp argument list of the sort accepted
757by @code{cl-defmacro}. The type specifier @samp{(@var{name} @var{args}...)} 760by @code{cl-defmacro}. The type specifier @samp{(@var{name} @var{args}@dots{})}
758is expanded by calling the expander with those arguments; the type 761is expanded by calling the expander with those arguments; the type
759symbol @samp{@var{name}} is expanded by calling the expander with 762symbol @samp{@var{name}} is expanded by calling the expander with
760no arguments. The @var{arglist} is processed the same as for 763no arguments. The @var{arglist} is processed the same as for
@@ -873,7 +876,7 @@ provides an even more convenient way to swap two variables;
873 876
874A @dfn{generalized variable} or @dfn{place form} is one of the many 877A @dfn{generalized variable} or @dfn{place form} is one of the many
875places in Lisp memory where values can be stored. The simplest place 878places in Lisp memory where values can be stored. The simplest place
876form is a regular Lisp variable. But the cars and cdrs of lists, 879form is a regular Lisp variable. But the @sc{car}s and @sc{cdr}s of lists,
877elements of arrays, properties of symbols, and many other locations 880elements of arrays, properties of symbols, and many other locations
878are also places where Lisp values are stored. For basic information, 881are also places where Lisp values are stored. For basic information,
879@pxref{Generalized Variables,,,elisp,GNU Emacs Lisp Reference Manual}. 882@pxref{Generalized Variables,,,elisp,GNU Emacs Lisp Reference Manual}.
@@ -888,17 +891,17 @@ generalized variables.
888@node Setf Extensions 891@node Setf Extensions
889@subsection Setf Extensions 892@subsection Setf Extensions
890 893
891Several standard (e.g. @code{car}) and Emacs-specific 894Several standard (e.g.@: @code{car}) and Emacs-specific
892(e.g. @code{window-point}) Lisp functions are @code{setf}-able by default. 895(e.g.@: @code{window-point}) Lisp functions are @code{setf}-able by default.
893This package defines @code{setf} handlers for several additional functions: 896This package defines @code{setf} handlers for several additional functions:
894 897
895@itemize 898@itemize
896@item 899@item
897Functions from @code{CL} itself: 900Functions from this package:
898@smallexample 901@example
899cl-caaar .. cl-cddddr cl-first .. cl-tenth 902cl-rest cl-subseq cl-get cl-getf
900cl-rest cl-get cl-getf cl-subseq 903cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth
901@end smallexample 904@end example
902 905
903@noindent 906@noindent
904Note that for @code{cl-getf} (as for @code{nthcdr}), the list argument 907Note that for @code{cl-getf} (as for @code{nthcdr}), the list argument
@@ -906,7 +909,7 @@ of the function must itself be a valid @var{place} form.
906 909
907@item 910@item
908General Emacs Lisp functions: 911General Emacs Lisp functions:
909@smallexample 912@example
910buffer-file-name getenv 913buffer-file-name getenv
911buffer-modified-p global-key-binding 914buffer-modified-p global-key-binding
912buffer-name local-key-binding 915buffer-name local-key-binding
@@ -932,7 +935,7 @@ frame-parameters window-width
932frame-visible-p x-get-secondary-selection 935frame-visible-p x-get-secondary-selection
933frame-width x-get-selection 936frame-width x-get-selection
934get-register 937get-register
935@end smallexample 938@end example
936 939
937Most of these have directly corresponding ``set'' functions, like 940Most of these have directly corresponding ``set'' functions, like
938@code{use-local-map} for @code{current-local-map}, or @code{goto-char} 941@code{use-local-map} for @code{current-local-map}, or @code{goto-char}
@@ -1146,7 +1149,7 @@ For example,
1146@example 1149@example
1147(cl-letf (((point) (point-min)) 1150(cl-letf (((point) (point-min))
1148 (a 17)) 1151 (a 17))
1149 ...) 1152 @dots{})
1150@end example 1153@end example
1151 1154
1152@noindent 1155@noindent
@@ -1486,7 +1489,7 @@ simply returning @code{nil}.
1486@defmac cl-typecase keyform clause@dots{} 1489@defmac cl-typecase keyform clause@dots{}
1487This macro is a version of @code{cl-case} that checks for types 1490This macro is a version of @code{cl-case} that checks for types
1488rather than values. Each @var{clause} is of the form 1491rather than values. Each @var{clause} is of the form
1489@samp{(@var{type} @var{body}...)}. @xref{Type Predicates}, 1492@samp{(@var{type} @var{body}@dots{})}. @xref{Type Predicates},
1490for a description of type specifiers. For example, 1493for a description of type specifiers. For example,
1491 1494
1492@example 1495@example
@@ -1499,7 +1502,7 @@ for a description of type specifiers. For example,
1499 1502
1500The type specifier @code{t} matches any type of object; the word 1503The type specifier @code{t} matches any type of object; the word
1501@code{otherwise} is also allowed. To make one clause match any of 1504@code{otherwise} is also allowed. To make one clause match any of
1502several types, use an @code{(or ...)} type specifier. 1505several types, use an @code{(or @dots{})} type specifier.
1503@end defmac 1506@end defmac
1504 1507
1505@defmac cl-etypecase keyform clause@dots{} 1508@defmac cl-etypecase keyform clause@dots{}
@@ -1582,7 +1585,7 @@ looping constructs to complement Emacs Lisp's basic @code{while}
1582loop. 1585loop.
1583 1586
1584@defmac cl-loop forms@dots{} 1587@defmac cl-loop forms@dots{}
1585The @code{CL} package supports both the simple, old-style meaning of 1588This package supports both the simple, old-style meaning of
1586@code{loop} and the extremely powerful and flexible feature known as 1589@code{loop} and the extremely powerful and flexible feature known as
1587the @dfn{Loop Facility} or @dfn{Loop Macro}. This more advanced 1590the @dfn{Loop Facility} or @dfn{Loop Macro}. This more advanced
1588facility is discussed in the following section; @pxref{Loop Facility}. 1591facility is discussed in the following section; @pxref{Loop Facility}.
@@ -2004,7 +2007,7 @@ at run-time, this is somewhat less efficient than @code{in} or
2004the successive indices (starting at 0) of the elements. 2007the successive indices (starting at 0) of the elements.
2005 2008
2006This clause type is taken from older versions of the @code{loop} macro, 2009This clause type is taken from older versions of the @code{loop} macro,
2007and is not present in modern Common Lisp. The @samp{using (sequence ...)} 2010and is not present in modern Common Lisp. The @samp{using (sequence @dots{})}
2008term of the older macros is not supported. 2011term of the older macros is not supported.
2009 2012
2010@item for @var{var} being the elements of-ref @var{sequence} 2013@item for @var{var} being the elements of-ref @var{sequence}
@@ -2036,7 +2039,7 @@ Due to a minor implementation restriction, it will not work to have
2036more than one @code{for} clause iterating over symbols, hash tables, 2039more than one @code{for} clause iterating over symbols, hash tables,
2037keymaps, overlays, or intervals in a given @code{cl-loop}. Fortunately, 2040keymaps, overlays, or intervals in a given @code{cl-loop}. Fortunately,
2038it would rarely if ever be useful to do so. It @emph{is} valid to mix 2041it would rarely if ever be useful to do so. It @emph{is} valid to mix
2039one of these types of clauses with other clauses like @code{for ... to} 2042one of these types of clauses with other clauses like @code{for @dots{} to}
2040or @code{while}. 2043or @code{while}.
2041 2044
2042@item for @var{var} being the hash-keys of @var{hash-table} 2045@item for @var{var} being the hash-keys of @var{hash-table}
@@ -2073,7 +2076,7 @@ This clause iterates over all key sequences defined by @var{keymap}
2073and its nested keymaps, where @var{var} takes on values which are 2076and its nested keymaps, where @var{var} takes on values which are
2074vectors. The strings or vectors 2077vectors. The strings or vectors
2075are reused for each iteration, so you must copy them if you wish to keep 2078are reused for each iteration, so you must copy them if you wish to keep
2076them permanently. You can add a @samp{using (key-bindings ...)} 2079them permanently. You can add a @samp{using (key-bindings @dots{})}
2077clause to get the command bindings as well. 2080clause to get the command bindings as well.
2078 2081
2079@item for @var{var} being the overlays [of @var{buffer}] @dots{} 2082@item for @var{var} being the overlays [of @var{buffer}] @dots{}
@@ -2120,8 +2123,8 @@ and successive iterations it will be set by evaluating @var{expr2}
2120these two loops are effectively the same: 2123these two loops are effectively the same:
2121 2124
2122@example 2125@example
2123(cl-loop for x on my-list by 'cddr do ...) 2126(cl-loop for x on my-list by 'cddr do @dots{})
2124(cl-loop for x = my-list then (cddr x) while x do ...) 2127(cl-loop for x = my-list then (cddr x) while x do @dots{})
2125@end example 2128@end example
2126 2129
2127Note that this type of @code{for} clause does not imply any sort 2130Note that this type of @code{for} clause does not imply any sort
@@ -2200,8 +2203,8 @@ This clause simply counts up to the specified number using an
2200internal temporary variable. The loops 2203internal temporary variable. The loops
2201 2204
2202@example 2205@example
2203(cl-loop repeat (1+ n) do ...) 2206(cl-loop repeat (1+ n) do @dots{})
2204(cl-loop for temp to n do ...) 2207(cl-loop for temp to n do @dots{})
2205@end example 2208@end example
2206 2209
2207@noindent 2210@noindent
@@ -2327,9 +2330,9 @@ otherwise leaves the variable alone during the loop. The following
2327loops are basically equivalent: 2330loops are basically equivalent:
2328 2331
2329@example 2332@example
2330(cl-loop with x = 17 do ...) 2333(cl-loop with x = 17 do @dots{})
2331(let ((x 17)) (cl-loop do ...)) 2334(let ((x 17)) (cl-loop do @dots{}))
2332(cl-loop for x = 17 then x do ...) 2335(cl-loop for x = 17 then x do @dots{})
2333@end example 2336@end example
2334 2337
2335Naturally, the variable @var{var} might be used for some purpose 2338Naturally, the variable @var{var} might be used for some purpose
@@ -2408,7 +2411,7 @@ This clause gives a name other than @code{nil} to the implicit
2408block surrounding the loop. The @var{name} is the symbol to be 2411block surrounding the loop. The @var{name} is the symbol to be
2409used as the block name. 2412used as the block name.
2410 2413
2411@item initially [do] @var{forms}... 2414@item initially [do] @var{forms}@dots{}
2412This keyword introduces one or more Lisp forms which will be 2415This keyword introduces one or more Lisp forms which will be
2413executed before the loop itself begins (but after any variables 2416executed before the loop itself begins (but after any variables
2414requested by @code{for} or @code{with} have been bound to their 2417requested by @code{for} or @code{with} have been bound to their
@@ -2416,7 +2419,7 @@ initial values). @code{initially} clauses can appear anywhere;
2416if there are several, they are executed in the order they appear 2419if there are several, they are executed in the order they appear
2417in the loop. The keyword @code{do} is optional. 2420in the loop. The keyword @code{do} is optional.
2418 2421
2419@item finally [do] @var{forms}... 2422@item finally [do] @var{forms}@dots{}
2420This introduces Lisp forms which will be executed after the loop 2423This introduces Lisp forms which will be executed after the loop
2421finishes (say, on request of a @code{for} or @code{while}). 2424finishes (say, on request of a @code{for} or @code{while}).
2422@code{initially} and @code{finally} clauses may appear anywhere 2425@code{initially} and @code{finally} clauses may appear anywhere
@@ -2431,7 +2434,7 @@ return @code{nil}.) Variables bound by @code{for}, @code{with},
2431or @code{into} will still contain their final values when @var{form} 2434or @code{into} will still contain their final values when @var{form}
2432is executed. 2435is executed.
2433 2436
2434@item do @var{forms}... 2437@item do @var{forms}@dots{}
2435The word @code{do} may be followed by any number of Lisp expressions 2438The word @code{do} may be followed by any number of Lisp expressions
2436which are executed as an implicit @code{progn} in the body of the 2439which are executed as an implicit @code{progn} in the body of the
2437loop. Many of the examples in this section illustrate the use of 2440loop. Many of the examples in this section illustrate the use of
@@ -2608,7 +2611,7 @@ is evaluated and thus should normally be quoted.
2608This macro is like @code{cl-proclaim}, except that it takes any number 2611This macro is like @code{cl-proclaim}, except that it takes any number
2609of @var{decl-spec} arguments, and the arguments are unevaluated and 2612of @var{decl-spec} arguments, and the arguments are unevaluated and
2610unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when 2613unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when
2611(compile load eval) ...)} around the declarations so that they will 2614(compile load eval) @dots{})} around the declarations so that they will
2612be registered at compile-time as well as at run-time. (This is vital, 2615be registered at compile-time as well as at run-time. (This is vital,
2613since normally the declarations are meant to influence the way the 2616since normally the declarations are meant to influence the way the
2614compiler treats the rest of the file that contains the @code{cl-declaim} 2617compiler treats the rest of the file that contains the @code{cl-declaim}
@@ -2691,7 +2694,7 @@ and declare it inline all at once.
2691(cl-declaim (inline foo bar)) 2694(cl-declaim (inline foo bar))
2692(cl-eval-when (compile load eval) 2695(cl-eval-when (compile load eval)
2693 (cl-proclaim '(inline foo bar))) 2696 (cl-proclaim '(inline foo bar)))
2694(defsubst foo (...) ...) ; instead of defun 2697(defsubst foo (@dots{}) @dots{}) ; instead of defun
2695@end example 2698@end example
2696 2699
2697@strong{Please note:} this declaration remains in effect after the 2700@strong{Please note:} this declaration remains in effect after the
@@ -2826,7 +2829,7 @@ list that corresponds to @var{property}, or to cons a new property-value
2826pair onto the list if the property is not yet present. 2829pair onto the list if the property is not yet present.
2827 2830
2828@example 2831@example
2829(put sym prop val) @equiv{} (setf (cl-getf (symbol-plist sym) prop) val) 2832(put sym prop val) @equiv{} (setf (cl-getf (symbol-plist sym) prop) val)
2830@end example 2833@end example
2831 2834
2832The @code{get} and @code{cl-get} functions are also @code{setf}-able. 2835The @code{get} and @code{cl-get} functions are also @code{setf}-able.
@@ -3180,9 +3183,9 @@ Emacs Lisp includes a few of these, notably @code{elt} and
3180 3183
3181@menu 3184@menu
3182* Sequence Basics:: Arguments shared by all sequence functions. 3185* Sequence Basics:: Arguments shared by all sequence functions.
3183* Mapping over Sequences:: @code{cl-mapcar}, @code{cl-mapcan}, @code{cl-map}, @code{cl-every}, etc. 3186* Mapping over Sequences:: @code{cl-mapcar}, @code{cl-map}, @code{cl-maplist}, etc.
3184* Sequence Functions:: @code{cl-subseq}, @code{cl-remove}, @code{cl-substitute}, etc. 3187* Sequence Functions:: @code{cl-subseq}, @code{cl-remove}, @code{cl-substitute}, etc.
3185* Searching Sequences:: @code{cl-find}, @code{cl-position}, @code{cl-count}, @code{cl-search}, etc. 3188* Searching Sequences:: @code{cl-find}, @code{cl-count}, @code{cl-search}, etc.
3186* Sorting Sequences:: @code{cl-sort}, @code{cl-stable-sort}, @code{cl-merge}. 3189* Sorting Sequences:: @code{cl-sort}, @code{cl-stable-sort}, @code{cl-merge}.
3187@end menu 3190@end menu
3188 3191
@@ -3198,7 +3201,7 @@ The @code{:key} argument should be passed either @code{nil}, or a
3198function of one argument. This key function is used as a filter 3201function of one argument. This key function is used as a filter
3199through which the elements of the sequence are seen; for example, 3202through which the elements of the sequence are seen; for example,
3200@code{(cl-find x y :key 'car)} is similar to @code{(cl-assoc x y)}: 3203@code{(cl-find x y :key 'car)} is similar to @code{(cl-assoc x y)}:
3201It searches for an element of the list whose @code{car} equals 3204It searches for an element of the list whose @sc{car} equals
3202@code{x}, rather than for an element which equals @code{x} itself. 3205@code{x}, rather than for an element which equals @code{x} itself.
3203If @code{:key} is omitted or @code{nil}, the filter is effectively 3206If @code{:key} is omitted or @code{nil}, the filter is effectively
3204the identity function. 3207the identity function.
@@ -3300,11 +3303,11 @@ thrown away and @code{cl-map} returns @code{nil}).
3300 3303
3301@defun cl-maplist function list &rest more-lists 3304@defun cl-maplist function list &rest more-lists
3302This function calls @var{function} on each of its argument lists, 3305This function calls @var{function} on each of its argument lists,
3303then on the @code{cdr}s of those lists, and so on, until the 3306then on the @sc{cdr}s of those lists, and so on, until the
3304shortest list runs out. The results are returned in the form 3307shortest list runs out. The results are returned in the form
3305of a list. Thus, @code{cl-maplist} is like @code{cl-mapcar} except 3308of a list. Thus, @code{cl-maplist} is like @code{cl-mapcar} except
3306that it passes in the list pointers themselves rather than the 3309that it passes in the list pointers themselves rather than the
3307@code{car}s of the advancing pointers. 3310@sc{car}s of the advancing pointers.
3308@end defun 3311@end defun
3309 3312
3310@defun cl-mapc function seq &rest more-seqs 3313@defun cl-mapc function seq &rest more-seqs
@@ -3630,7 +3633,7 @@ simple accessor though, it's used heavily in the current
3630implementation. 3633implementation.
3631 3634
3632The @code{cl-sort} function is destructive; it sorts lists by actually 3635The @code{cl-sort} function is destructive; it sorts lists by actually
3633rearranging the @code{cdr} pointers in suitable fashion. 3636rearranging the @sc{cdr} pointers in suitable fashion.
3634@end defun 3637@end defun
3635 3638
3636@defun cl-stable-sort seq predicate @t{&key :key} 3639@defun cl-stable-sort seq predicate @t{&key :key}
@@ -3670,7 +3673,7 @@ The functions described here operate on lists.
3670* List Functions:: @code{cl-caddr}, @code{cl-first}, @code{cl-list*}, etc. 3673* List Functions:: @code{cl-caddr}, @code{cl-first}, @code{cl-list*}, etc.
3671* Substitution of Expressions:: @code{cl-subst}, @code{cl-sublis}, etc. 3674* Substitution of Expressions:: @code{cl-subst}, @code{cl-sublis}, etc.
3672* Lists as Sets:: @code{cl-member}, @code{cl-adjoin}, @code{cl-union}, etc. 3675* Lists as Sets:: @code{cl-member}, @code{cl-adjoin}, @code{cl-union}, etc.
3673* Association Lists:: @code{cl-assoc}, @code{cl-rassoc}, @code{cl-acons}, @code{cl-pairlis}. 3676* Association Lists:: @code{cl-assoc}, @code{cl-acons}, @code{cl-pairlis}, etc.
3674@end menu 3677@end menu
3675 3678
3676@node List Functions 3679@node List Functions
@@ -3708,14 +3711,14 @@ for @code{null}.
3708@defun cl-list-length x 3711@defun cl-list-length x
3709This function returns the length of list @var{x}, exactly like 3712This function returns the length of list @var{x}, exactly like
3710@code{(length @var{x})}, except that if @var{x} is a circular 3713@code{(length @var{x})}, except that if @var{x} is a circular
3711list (where the cdr-chain forms a loop rather than terminating 3714list (where the @sc{cdr}-chain forms a loop rather than terminating
3712with @code{nil}), this function returns @code{nil}. (The regular 3715with @code{nil}), this function returns @code{nil}. (The regular
3713@code{length} function would get stuck if given a circular list.) 3716@code{length} function would get stuck if given a circular list.)
3714@end defun 3717@end defun
3715 3718
3716@defun cl-list* arg &rest others 3719@defun cl-list* arg &rest others
3717This function constructs a list of its arguments. The final 3720This function constructs a list of its arguments. The final
3718argument becomes the @code{cdr} of the last cell constructed. 3721argument becomes the @sc{cdr} of the last cell constructed.
3719Thus, @code{(cl-list* @var{a} @var{b} @var{c})} is equivalent to 3722Thus, @code{(cl-list* @var{a} @var{b} @var{c})} is equivalent to
3720@code{(cons @var{a} (cons @var{b} @var{c}))}, and 3723@code{(cons @var{a} (cons @var{b} @var{c}))}, and
3721@code{(cl-list* @var{a} @var{b} nil)} is equivalent to 3724@code{(cl-list* @var{a} @var{b} nil)} is equivalent to
@@ -3742,8 +3745,8 @@ dotted lists like @code{(1 2 . 3)} correctly.
3742This function returns a copy of the tree of cons cells @var{x}. 3745This function returns a copy of the tree of cons cells @var{x}.
3743@c FIXME? cl-copy-list is not an alias of copy-sequence. 3746@c FIXME? cl-copy-list is not an alias of copy-sequence.
3744Unlike @code{copy-sequence} (and its alias @code{cl-copy-list}), 3747Unlike @code{copy-sequence} (and its alias @code{cl-copy-list}),
3745which copies only along the @code{cdr} direction, this function 3748which copies only along the @sc{cdr} direction, this function
3746copies (recursively) along both the @code{car} and the @code{cdr} 3749copies (recursively) along both the @sc{car} and the @sc{cdr}
3747directions. If @var{x} is not a cons cell, the function simply 3750directions. If @var{x} is not a cons cell, the function simply
3748returns @var{x} unchanged. If the optional @var{vecp} argument 3751returns @var{x} unchanged. If the optional @var{vecp} argument
3749is true, this function copies vectors (recursively) as well as 3752is true, this function copies vectors (recursively) as well as
@@ -3752,7 +3755,7 @@ cons cells.
3752 3755
3753@defun cl-tree-equal x y @t{&key :test :test-not :key} 3756@defun cl-tree-equal x y @t{&key :test :test-not :key}
3754This function compares two trees of cons cells. If @var{x} and 3757This function compares two trees of cons cells. If @var{x} and
3755@var{y} are both cons cells, their @code{car}s and @code{cdr}s are 3758@var{y} are both cons cells, their @sc{car}s and @sc{cdr}s are
3756compared recursively. If neither @var{x} nor @var{y} is a cons 3759compared recursively. If neither @var{x} nor @var{y} is a cons
3757cell, they are compared by @code{eql}, or according to the 3760cell, they are compared by @code{eql}, or according to the
3758specified test. The @code{:key} function, if specified, is 3761specified test. The @code{:key} function, if specified, is
@@ -3773,7 +3776,7 @@ in @var{tree}, a tree of cons cells. It returns a substituted
3773tree, which will be a copy except that it may share storage with 3776tree, which will be a copy except that it may share storage with
3774the argument @var{tree} in parts where no substitutions occurred. 3777the argument @var{tree} in parts where no substitutions occurred.
3775The original @var{tree} is not modified. This function recurses 3778The original @var{tree} is not modified. This function recurses
3776on, and compares against @var{old}, both @code{car}s and @code{cdr}s 3779on, and compares against @var{old}, both @sc{car}s and @sc{cdr}s
3777of the component cons cells. If @var{old} is itself a cons cell, 3780of the component cons cells. If @var{old} is itself a cons cell,
3778then matching cells in the tree are substituted as usual without 3781then matching cells in the tree are substituted as usual without
3779recursively substituting in that cell. Comparisons with @var{old} 3782recursively substituting in that cell. Comparisons with @var{old}
@@ -3799,9 +3802,9 @@ The @code{cl-subst-if}, @code{cl-subst-if-not}, @code{cl-nsubst-if}, and
3799This function is like @code{cl-subst}, except that it takes an 3802This function is like @code{cl-subst}, except that it takes an
3800association list @var{alist} of @var{old}-@var{new} pairs. 3803association list @var{alist} of @var{old}-@var{new} pairs.
3801Each element of the tree (after applying the @code{:key} 3804Each element of the tree (after applying the @code{:key}
3802function, if any), is compared with the @code{car}s of 3805function, if any), is compared with the @sc{car}s of
3803@var{alist}; if it matches, it is replaced by the corresponding 3806@var{alist}; if it matches, it is replaced by the corresponding
3804@code{cdr}. 3807@sc{cdr}.
3805@end defun 3808@end defun
3806 3809
3807@defun cl-nsublis alist tree @t{&key :test :test-not :key} 3810@defun cl-nsublis alist tree @t{&key :test :test-not :key}
@@ -3817,7 +3820,7 @@ of elements.
3817 3820
3818@defun cl-member item list @t{&key :test :test-not :key} 3821@defun cl-member item list @t{&key :test :test-not :key}
3819This function searches @var{list} for an element matching @var{item}. 3822This function searches @var{list} for an element matching @var{item}.
3820If a match is found, it returns the cons cell whose @code{car} was 3823If a match is found, it returns the cons cell whose @sc{car} was
3821the matching element. Otherwise, it returns @code{nil}. Elements 3824the matching element. Otherwise, it returns @code{nil}. Elements
3822are compared by @code{eql} by default; you can use the @code{:test}, 3825are compared by @code{eql} by default; you can use the @code{:test},
3823@code{:test-not}, and @code{:key} arguments to modify this behavior. 3826@code{:test-not}, and @code{:key} arguments to modify this behavior.
@@ -3836,7 +3839,7 @@ analogously search for elements which satisfy a given predicate.
3836@defun cl-tailp sublist list 3839@defun cl-tailp sublist list
3837This function returns @code{t} if @var{sublist} is a sublist of 3840This function returns @code{t} if @var{sublist} is a sublist of
3838@var{list}, i.e., if @var{sublist} is @code{eql} to @var{list} or to 3841@var{list}, i.e., if @var{sublist} is @code{eql} to @var{list} or to
3839any of its @code{cdr}s. 3842any of its @sc{cdr}s.
3840@end defun 3843@end defun
3841 3844
3842@defun cl-adjoin item list @t{&key :test :test-not :key} 3845@defun cl-adjoin item list @t{&key :test :test-not :key}
@@ -3916,7 +3919,7 @@ cells is an association list.
3916 3919
3917@defun cl-assoc item a-list @t{&key :test :test-not :key} 3920@defun cl-assoc item a-list @t{&key :test :test-not :key}
3918This function searches the association list @var{a-list} for an 3921This function searches the association list @var{a-list} for an
3919element whose @code{car} matches (in the sense of @code{:test}, 3922element whose @sc{car} matches (in the sense of @code{:test},
3920@code{:test-not}, and @code{:key}, or by comparison with @code{eql}) 3923@code{:test-not}, and @code{:key}, or by comparison with @code{eql})
3921a given @var{item}. It returns the matching element, if any, 3924a given @var{item}. It returns the matching element, if any,
3922otherwise @code{nil}. It ignores elements of @var{a-list} which 3925otherwise @code{nil}. It ignores elements of @var{a-list} which
@@ -3927,7 +3930,7 @@ elements of @var{a-list} to be an error.)
3927@end defun 3930@end defun
3928 3931
3929@defun cl-rassoc item a-list @t{&key :test :test-not :key} 3932@defun cl-rassoc item a-list @t{&key :test :test-not :key}
3930This function searches for an element whose @code{cdr} matches 3933This function searches for an element whose @sc{cdr} matches
3931@var{item}. If @var{a-list} represents a mapping, this applies 3934@var{item}. If @var{a-list} represents a mapping, this applies
3932the inverse of the mapping to @var{item}. 3935the inverse of the mapping to @var{item}.
3933@end defun 3936@end defun
@@ -4609,7 +4612,7 @@ for themselves, which the Emacs parser is incapable of reading.
4609@item 4612@item
4610Other syntactic features. Common Lisp provides a number of 4613Other syntactic features. Common Lisp provides a number of
4611notations beginning with @code{#} that the Emacs Lisp parser 4614notations beginning with @code{#} that the Emacs Lisp parser
4612won't understand. For example, @samp{#| ... |#} is an 4615won't understand. For example, @samp{#| @dots{} |#} is an
4613alternate comment notation, and @samp{#+lucid (foo)} tells 4616alternate comment notation, and @samp{#+lucid (foo)} tells
4614the parser to ignore the @code{(foo)} except in Lucid Common 4617the parser to ignore the @code{(foo)} except in Lucid Common
4615Lisp. 4618Lisp.
@@ -4659,7 +4662,7 @@ While it would have been possible to implement most of Common
4659Lisp @code{format} in this package (under the name @code{cl-format}, 4662Lisp @code{format} in this package (under the name @code{cl-format},
4660of course), it was not deemed worthwhile. It would have required 4663of course), it was not deemed worthwhile. It would have required
4661a huge amount of code to implement even a decent subset of 4664a huge amount of code to implement even a decent subset of
4662@code{cl-format}, yet the functionality it would provide over 4665@code{format}, yet the functionality it would provide over
4663Emacs Lisp's @code{format} would rarely be useful. 4666Emacs Lisp's @code{format} would rarely be useful.
4664 4667
4665@item 4668@item
@@ -4725,8 +4728,8 @@ where a more iteratively-minded programmer might write one of
4725these forms: 4728these forms:
4726 4729
4727@example 4730@example
4728(let ((total 0)) (dolist (x my-list) (cl-incf total x)) total) 4731(let ((total 0)) (dolist (x my-list) (incf total x)) total)
4729(cl-loop for x in my-list sum x) 4732(loop for x in my-list sum x)
4730@end example 4733@end example
4731 4734
4732While this would be mainly a stylistic choice in most Common Lisps, 4735While this would be mainly a stylistic choice in most Common Lisps,
@@ -4888,7 +4891,7 @@ that @code{flet} affects indirect calls to a function as well as calls
4888directly inside the @code{flet} form itself. 4891directly inside the @code{flet} form itself.
4889 4892
4890@c Bug#411. 4893@c Bug#411.
4891Note that many primitives (e.g. @code{+}) have special byte-compile 4894Note that many primitives (e.g.@: @code{+}) have special byte-compile
4892handling. Attempts to redefine such functions using @code{flet} will 4895handling. Attempts to redefine such functions using @code{flet} will
4893fail if byte-compiled. 4896fail if byte-compiled.
4894@c Or cl-flet. 4897@c Or cl-flet.
@@ -4930,21 +4933,21 @@ to take a @var{place} argument followed by additional arguments
4930described by @var{arglist}. The call 4933described by @var{arglist}. The call
4931 4934
4932@example 4935@example
4933(@var{name} @var{place} @var{args}...) 4936(@var{name} @var{place} @var{args}@dots{})
4934@end example 4937@end example
4935 4938
4936@noindent 4939@noindent
4937will be expanded to 4940will be expanded to
4938 4941
4939@example 4942@example
4940(cl-callf @var{func} @var{place} @var{args}...) 4943(cl-callf @var{func} @var{place} @var{args}@dots{})
4941@end example 4944@end example
4942 4945
4943@noindent 4946@noindent
4944which in turn is roughly equivalent to 4947which in turn is roughly equivalent to
4945 4948
4946@example 4949@example
4947(setf @var{place} (@var{func} @var{place} @var{args}...)) 4950(setf @var{place} (@var{func} @var{place} @var{args}@dots{}))
4948@end example 4951@end example
4949 4952
4950For example: 4953For example: