diff options
| author | Glenn Morris | 2012-10-31 21:44:50 -0400 |
|---|---|---|
| committer | Glenn Morris | 2012-10-31 21:44:50 -0400 |
| commit | df43dd5361372fffb5d1618228a9c6a55db96169 (patch) | |
| tree | 721d49c00d91ca0fed4880a223594afc6a3ed881 /doc | |
| parent | 87b0d8b1d1ca858c76afa23e4a936bdd9fd8c2e1 (diff) | |
| download | emacs-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')
| -rw-r--r-- | doc/misc/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/misc/cl.texi | 235 |
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 @@ | |||
| 1 | 2012-11-01 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * cl.texi: General copyedits for style, line-breaks, etc. | ||
| 4 | |||
| 1 | 2012-10-31 Glenn Morris <rgm@gnu.org> | 5 | 2012-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 | ||
| 70 | Appendices | ||
| 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:: | 77 | Indexes |
| 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 | |||
| 93 | they write have grown more ambitious, it has become clear that Emacs | 95 | they write have grown more ambitious, it has become clear that Emacs |
| 94 | Lisp could benefit from many of the conveniences of Common Lisp. | 96 | Lisp could benefit from many of the conveniences of Common Lisp. |
| 95 | 97 | ||
| 96 | The @code{CL} package adds a number of Common Lisp functions and | 98 | The @dfn{CL} package adds a number of Common Lisp functions and |
| 97 | control structures to Emacs Lisp. While not a 100% complete | 99 | control structures to Emacs Lisp. While not a 100% complete |
| 98 | implementation of Common Lisp, @code{CL} adds enough functionality | 100 | implementation of Common Lisp, it adds enough functionality |
| 99 | to make Emacs Lisp programming significantly more convenient. | 101 | to make Emacs Lisp programming significantly more convenient. |
| 100 | 102 | ||
| 101 | Some Common Lisp features have been omitted from this package | 103 | Some Common Lisp features have been omitted from this package |
| @@ -111,8 +113,7 @@ examples of this group. | |||
| 111 | Other features cannot be implemented without modification to the | 113 | Other features cannot be implemented without modification to the |
| 112 | Emacs Lisp interpreter itself, such as multiple return values, | 114 | Emacs Lisp interpreter itself, such as multiple return values, |
| 113 | case-insensitive symbols, and complex numbers. | 115 | case-insensitive symbols, and complex numbers. |
| 114 | The @code{CL} package generally makes no attempt to emulate these | 116 | This package generally makes no attempt to emulate these features. |
| 115 | features. | ||
| 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 | |||
| 124 | file @file{cl-lib.el} and rationalized the namespace for Emacs 24.3. | 125 | file @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 |
| 136 | The @code{CL} package is distributed with Emacs, so there is no need | 137 | This package is distributed with Emacs, so there is no need |
| 137 | to install any additional files in order to start using it. Lisp code | 138 | to install any additional files in order to start using it. Lisp code |
| 138 | that uses features from the @code{CL} package should simply include at | 139 | that uses features from this package should simply include at |
| 139 | the beginning: | 140 | the beginning: |
| 140 | 141 | ||
| 141 | @example | 142 | @example |
| @@ -144,7 +145,7 @@ the beginning: | |||
| 144 | 145 | ||
| 145 | @noindent | 146 | @noindent |
| 146 | You may wish to add such a statement to your init file, if you | 147 | You may wish to add such a statement to your init file, if you |
| 147 | make frequent use of CL features. | 148 | make 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 | |||
| 183 | needed. | 184 | needed. |
| 184 | 185 | ||
| 185 | There is another file, @file{cl.el}, which was the main entry point to | 186 | There is another file, @file{cl.el}, which was the main entry point to |
| 186 | the CL package prior to Emacs 24.3. Nowadays, it is replaced by | 187 | this 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), |
| 188 | but use different function names (in fact, @file{cl.el} mainly just | 189 | but use different function names (in fact, @file{cl.el} mainly just |
| 189 | defines aliases to the @file{cl-lib.el} definitions). Where | 190 | defines 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 |
| 193 | exceptions to this. First, functions such as @code{cl-defun} where | 194 | exceptions to this. First, functions such as @code{cl-defun} where |
| 194 | the unprefixed version was already used for a standard Emacs Lisp | 195 | the unprefixed version was already used for a standard Emacs Lisp |
| 195 | function. In such cases, the @file{cl.el} version adds a @samp{*} | 196 | function. In such cases, the @file{cl.el} version adds a @samp{*} |
| 196 | suffix, e.g. @code{defun*}. Second, there are some obsolete features | 197 | suffix, e.g.@: @code{defun*}. Second, there are some obsolete features |
| 197 | that are only implemented in @file{cl.el}, not in @file{cl-lib.el}, | 198 | that are only implemented in @file{cl.el}, not in @file{cl-lib.el}, |
| 198 | because they are replaced by other standard Emacs Lisp features. | 199 | because they are replaced by other standard Emacs Lisp features. |
| 199 | Finally, in a very few cases the old @file{cl.el} versions do not | 200 | Finally, 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 | |||
| 210 | should use @code{cl-lib} rather than @code{cl}. | 211 | should use @code{cl-lib} rather than @code{cl}. |
| 211 | 212 | ||
| 212 | There is one more file, @file{cl-compat.el}, which defines some | 213 | There is one more file, @file{cl-compat.el}, which defines some |
| 213 | routines from the older Quiroz CL package that are not otherwise | 214 | routines from the older Quiroz @file{cl.el} package that are not otherwise |
| 214 | present in the new package. This file is obsolete and should not be | 215 | present in the new package. This file is obsolete and should not be |
| 215 | used in new code. | 216 | used in new code. |
| 216 | 217 | ||
| @@ -224,42 +225,44 @@ names that are those of Common Lisp plus a @samp{cl-} prefix. | |||
| 224 | 225 | ||
| 225 | Internal function and variable names in the package are prefixed | 226 | Internal function and variable names in the package are prefixed |
| 226 | by @code{cl--}. Here is a complete list of functions prefixed by | 227 | by @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 |
| 230 | cl-callf cl-callf2 cl-defsubst | 231 | cl-callf cl-callf2 cl-defsubst |
| 231 | cl-floatp-safe cl-letf cl-letf* | 232 | cl-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. | ||
| 234 | The following simple functions and macros are defined in @file{cl-lib.el}; | 237 | The following simple functions and macros are defined in @file{cl-lib.el}; |
| 235 | they do not cause other components like @file{cl-extra} to be loaded. | 238 | they do not cause other components like @file{cl-extra} to be loaded. |
| 236 | 239 | ||
| 237 | @example | 240 | @example |
| 238 | cl-floatp-safe cl-endp | 241 | cl-evenp cl-oddp cl-minusp |
| 239 | cl-evenp cl-oddp cl-plusp cl-minusp | 242 | cl-plusp cl-floatp-safe cl-endp |
| 240 | cl-caaar .. cl-cddddr | 243 | cl-copy-list cl-list* cl-ldiff |
| 241 | cl-list* cl-ldiff cl-rest cl-first .. cl-tenth | 244 | cl-rest cl-decf [1] cl-incf [1] |
| 242 | cl-copy-list cl-subst cl-mapcar [2] | 245 | cl-acons cl-adjoin [2] cl-pairlis |
| 243 | cl-adjoin [3] cl-acons cl-pairlis | 246 | cl-pushnew [1,2] cl-declaim cl-proclaim |
| 244 | cl-pushnew [3,4] cl-incf [4] cl-decf [4] | 247 | cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth |
| 245 | cl-proclaim cl-declaim | 248 | cl-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, |
| 253 | and @code{:key} is not used. | 256 | and @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 |
| 262 | This section describes features of the @code{CL} package that have to | 265 | This section describes features of this package that have to |
| 263 | do with programs as a whole: advanced argument lists for functions, | 266 | do with programs as a whole: advanced argument lists for functions, |
| 264 | and the @code{cl-eval-when} construct. | 267 | and the @code{cl-eval-when} construct. |
| 265 | 268 | ||
| @@ -283,14 +286,14 @@ this package to implement Common Lisp argument lists seamlessly. | |||
| 283 | Instead, this package defines alternates for several Lisp forms | 286 | Instead, this package defines alternates for several Lisp forms |
| 284 | which you must use if you need Common Lisp argument lists. | 287 | which 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{} |
| 287 | This form is identical to the regular @code{defun} form, except | 290 | This form is identical to the regular @code{defun} form, except |
| 288 | that @var{arglist} is allowed to be a full Common Lisp argument | 291 | that @var{arglist} is allowed to be a full Common Lisp argument |
| 289 | list. Also, the function body is enclosed in an implicit block | 292 | list. Also, the function body is enclosed in an implicit block |
| 290 | called @var{name}; @pxref{Blocks and Exits}. | 293 | called @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{} |
| 294 | This is just like @code{cl-defun}, except that the function that | 297 | This is just like @code{cl-defun}, except that the function that |
| 295 | is defined is automatically proclaimed @code{inline}, i.e., | 298 | is defined is automatically proclaimed @code{inline}, i.e., |
| 296 | calls to it may be expanded into in-line code by the byte compiler. | 299 | calls 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, | |||
| 302 | etc., to be done at compile-time whenever possible. | 305 | etc., 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{} |
| 306 | This is identical to the regular @code{defmacro} form, | 309 | This is identical to the regular @code{defmacro} form, |
| 307 | except that @var{arglist} is allowed to be a full Common Lisp | 310 | except that @var{arglist} is allowed to be a full Common Lisp |
| 308 | argument list. The @code{&environment} keyword is supported as | 311 | argument list. The @code{&environment} keyword is supported as |
| @@ -324,7 +327,7 @@ in this package that include @var{arglist}s in their syntax allow | |||
| 324 | full Common Lisp argument lists. | 327 | full Common Lisp argument lists. |
| 325 | 328 | ||
| 326 | Note that it is @emph{not} necessary to use @code{cl-defun} in | 329 | Note that it is @emph{not} necessary to use @code{cl-defun} in |
| 327 | order to have access to most @code{CL} features in your function. | 330 | order to have access to most CL features in your function. |
| 328 | These features are always present; @code{cl-defun}'s only | 331 | These features are always present; @code{cl-defun}'s only |
| 329 | difference from @code{defun} is its more flexible argument | 332 | difference from @code{defun} is its more flexible argument |
| 330 | lists and its implicit block. | 333 | lists and its implicit block. |
| @@ -332,11 +335,11 @@ lists and its implicit block. | |||
| 332 | The full form of a Common Lisp argument list is | 335 | The 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 | ||
| 342 | Each of the five argument list sections is optional. The @var{svar}, | 345 | Each 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, | |||
| 426 | the ``rest'' argument is bound to the keyword list as it appears | 429 | the ``rest'' argument is bound to the keyword list as it appears |
| 427 | in the call. For example: | 430 | in 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 |
| 436 | This function takes a @code{:need} keyword argument, but also | 439 | This 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 | ||
| 473 | This says that the first argument of @code{dolist} must be a list | 476 | This 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 | |||
| 506 | at compile-time so that later parts of the file can refer to the | 509 | at compile-time so that later parts of the file can refer to the |
| 507 | macros that are defined. | 510 | macros that are defined. |
| 508 | 511 | ||
| 509 | @defmac cl-eval-when (situations...) forms... | 512 | @defmac cl-eval-when (situations@dots{}) forms@dots{} |
| 510 | This form controls when the body @var{forms} are evaluated. | 513 | This form controls when the body @var{forms} are evaluated. |
| 511 | The @var{situations} list may contain any set of the symbols | 514 | The @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 | |||
| 588 | equivalent to @samp{(cl-eval-when (compile load eval) @dots{})} and | 591 | equivalent to @samp{(cl-eval-when (compile load eval) @dots{})} and |
| 589 | so is not itself defined by this package. | 592 | so is not itself defined by this package. |
| 590 | 593 | ||
| 591 | @defmac eval-when-compile forms... | 594 | @defmac eval-when-compile forms@dots{} |
| 592 | The @var{forms} are evaluated at compile-time; at execution time, | 595 | The @var{forms} are evaluated at compile-time; at execution time, |
| 593 | this form acts like a quoted constant of the resulting value. Used | 596 | this form acts like a quoted constant of the resulting value. Used |
| 594 | at top-level, @code{eval-when-compile} is just like @samp{eval-when | 597 | at 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 | |||
| 748 | error. | 751 | error. |
| 749 | @end defun | 752 | @end defun |
| 750 | 753 | ||
| 751 | @defmac cl-deftype name arglist forms... | 754 | @defmac cl-deftype name arglist forms@dots{} |
| 752 | This macro defines a new type called @var{name}. It is similar | 755 | This macro defines a new type called @var{name}. It is similar |
| 753 | to @code{defmacro} in many ways; when @var{name} is encountered | 756 | to @code{defmacro} in many ways; when @var{name} is encountered |
| 754 | as a type name, the body @var{forms} are evaluated and should | 757 | as a type name, the body @var{forms} are evaluated and should |
| 755 | return a type specifier that is equivalent to the type. The | 758 | return 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 |
| 757 | by @code{cl-defmacro}. The type specifier @samp{(@var{name} @var{args}...)} | 760 | by @code{cl-defmacro}. The type specifier @samp{(@var{name} @var{args}@dots{})} |
| 758 | is expanded by calling the expander with those arguments; the type | 761 | is expanded by calling the expander with those arguments; the type |
| 759 | symbol @samp{@var{name}} is expanded by calling the expander with | 762 | symbol @samp{@var{name}} is expanded by calling the expander with |
| 760 | no arguments. The @var{arglist} is processed the same as for | 763 | no 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 | ||
| 874 | A @dfn{generalized variable} or @dfn{place form} is one of the many | 877 | A @dfn{generalized variable} or @dfn{place form} is one of the many |
| 875 | places in Lisp memory where values can be stored. The simplest place | 878 | places in Lisp memory where values can be stored. The simplest place |
| 876 | form is a regular Lisp variable. But the cars and cdrs of lists, | 879 | form is a regular Lisp variable. But the @sc{car}s and @sc{cdr}s of lists, |
| 877 | elements of arrays, properties of symbols, and many other locations | 880 | elements of arrays, properties of symbols, and many other locations |
| 878 | are also places where Lisp values are stored. For basic information, | 881 | are 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 | ||
| 891 | Several standard (e.g. @code{car}) and Emacs-specific | 894 | Several 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. |
| 893 | This package defines @code{setf} handlers for several additional functions: | 896 | This package defines @code{setf} handlers for several additional functions: |
| 894 | 897 | ||
| 895 | @itemize | 898 | @itemize |
| 896 | @item | 899 | @item |
| 897 | Functions from @code{CL} itself: | 900 | Functions from this package: |
| 898 | @smallexample | 901 | @example |
| 899 | cl-caaar .. cl-cddddr cl-first .. cl-tenth | 902 | cl-rest cl-subseq cl-get cl-getf |
| 900 | cl-rest cl-get cl-getf cl-subseq | 903 | cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth |
| 901 | @end smallexample | 904 | @end example |
| 902 | 905 | ||
| 903 | @noindent | 906 | @noindent |
| 904 | Note that for @code{cl-getf} (as for @code{nthcdr}), the list argument | 907 | Note 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 |
| 908 | General Emacs Lisp functions: | 911 | General Emacs Lisp functions: |
| 909 | @smallexample | 912 | @example |
| 910 | buffer-file-name getenv | 913 | buffer-file-name getenv |
| 911 | buffer-modified-p global-key-binding | 914 | buffer-modified-p global-key-binding |
| 912 | buffer-name local-key-binding | 915 | buffer-name local-key-binding |
| @@ -932,7 +935,7 @@ frame-parameters window-width | |||
| 932 | frame-visible-p x-get-secondary-selection | 935 | frame-visible-p x-get-secondary-selection |
| 933 | frame-width x-get-selection | 936 | frame-width x-get-selection |
| 934 | get-register | 937 | get-register |
| 935 | @end smallexample | 938 | @end example |
| 936 | 939 | ||
| 937 | Most of these have directly corresponding ``set'' functions, like | 940 | Most 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{} |
| 1487 | This macro is a version of @code{cl-case} that checks for types | 1490 | This macro is a version of @code{cl-case} that checks for types |
| 1488 | rather than values. Each @var{clause} is of the form | 1491 | rather 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}, |
| 1490 | for a description of type specifiers. For example, | 1493 | for 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 | ||
| 1500 | The type specifier @code{t} matches any type of object; the word | 1503 | The 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 |
| 1502 | several types, use an @code{(or ...)} type specifier. | 1505 | several 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} | |||
| 1582 | loop. | 1585 | loop. |
| 1583 | 1586 | ||
| 1584 | @defmac cl-loop forms@dots{} | 1587 | @defmac cl-loop forms@dots{} |
| 1585 | The @code{CL} package supports both the simple, old-style meaning of | 1588 | This 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 |
| 1587 | the @dfn{Loop Facility} or @dfn{Loop Macro}. This more advanced | 1590 | the @dfn{Loop Facility} or @dfn{Loop Macro}. This more advanced |
| 1588 | facility is discussed in the following section; @pxref{Loop Facility}. | 1591 | facility 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 | |||
| 2004 | the successive indices (starting at 0) of the elements. | 2007 | the successive indices (starting at 0) of the elements. |
| 2005 | 2008 | ||
| 2006 | This clause type is taken from older versions of the @code{loop} macro, | 2009 | This clause type is taken from older versions of the @code{loop} macro, |
| 2007 | and is not present in modern Common Lisp. The @samp{using (sequence ...)} | 2010 | and is not present in modern Common Lisp. The @samp{using (sequence @dots{})} |
| 2008 | term of the older macros is not supported. | 2011 | term 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 | |||
| 2036 | more than one @code{for} clause iterating over symbols, hash tables, | 2039 | more than one @code{for} clause iterating over symbols, hash tables, |
| 2037 | keymaps, overlays, or intervals in a given @code{cl-loop}. Fortunately, | 2040 | keymaps, overlays, or intervals in a given @code{cl-loop}. Fortunately, |
| 2038 | it would rarely if ever be useful to do so. It @emph{is} valid to mix | 2041 | it would rarely if ever be useful to do so. It @emph{is} valid to mix |
| 2039 | one of these types of clauses with other clauses like @code{for ... to} | 2042 | one of these types of clauses with other clauses like @code{for @dots{} to} |
| 2040 | or @code{while}. | 2043 | or @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} | |||
| 2073 | and its nested keymaps, where @var{var} takes on values which are | 2076 | and its nested keymaps, where @var{var} takes on values which are |
| 2074 | vectors. The strings or vectors | 2077 | vectors. The strings or vectors |
| 2075 | are reused for each iteration, so you must copy them if you wish to keep | 2078 | are reused for each iteration, so you must copy them if you wish to keep |
| 2076 | them permanently. You can add a @samp{using (key-bindings ...)} | 2079 | them permanently. You can add a @samp{using (key-bindings @dots{})} |
| 2077 | clause to get the command bindings as well. | 2080 | clause 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} | |||
| 2120 | these two loops are effectively the same: | 2123 | these 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 | ||
| 2127 | Note that this type of @code{for} clause does not imply any sort | 2130 | Note 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 | |||
| 2200 | internal temporary variable. The loops | 2203 | internal 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 | |||
| 2327 | loops are basically equivalent: | 2330 | loops 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 | ||
| 2335 | Naturally, the variable @var{var} might be used for some purpose | 2338 | Naturally, 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 | |||
| 2408 | block surrounding the loop. The @var{name} is the symbol to be | 2411 | block surrounding the loop. The @var{name} is the symbol to be |
| 2409 | used as the block name. | 2412 | used as the block name. |
| 2410 | 2413 | ||
| 2411 | @item initially [do] @var{forms}... | 2414 | @item initially [do] @var{forms}@dots{} |
| 2412 | This keyword introduces one or more Lisp forms which will be | 2415 | This keyword introduces one or more Lisp forms which will be |
| 2413 | executed before the loop itself begins (but after any variables | 2416 | executed before the loop itself begins (but after any variables |
| 2414 | requested by @code{for} or @code{with} have been bound to their | 2417 | requested by @code{for} or @code{with} have been bound to their |
| @@ -2416,7 +2419,7 @@ initial values). @code{initially} clauses can appear anywhere; | |||
| 2416 | if there are several, they are executed in the order they appear | 2419 | if there are several, they are executed in the order they appear |
| 2417 | in the loop. The keyword @code{do} is optional. | 2420 | in the loop. The keyword @code{do} is optional. |
| 2418 | 2421 | ||
| 2419 | @item finally [do] @var{forms}... | 2422 | @item finally [do] @var{forms}@dots{} |
| 2420 | This introduces Lisp forms which will be executed after the loop | 2423 | This introduces Lisp forms which will be executed after the loop |
| 2421 | finishes (say, on request of a @code{for} or @code{while}). | 2424 | finishes (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}, | |||
| 2431 | or @code{into} will still contain their final values when @var{form} | 2434 | or @code{into} will still contain their final values when @var{form} |
| 2432 | is executed. | 2435 | is executed. |
| 2433 | 2436 | ||
| 2434 | @item do @var{forms}... | 2437 | @item do @var{forms}@dots{} |
| 2435 | The word @code{do} may be followed by any number of Lisp expressions | 2438 | The word @code{do} may be followed by any number of Lisp expressions |
| 2436 | which are executed as an implicit @code{progn} in the body of the | 2439 | which are executed as an implicit @code{progn} in the body of the |
| 2437 | loop. Many of the examples in this section illustrate the use of | 2440 | loop. Many of the examples in this section illustrate the use of |
| @@ -2608,7 +2611,7 @@ is evaluated and thus should normally be quoted. | |||
| 2608 | This macro is like @code{cl-proclaim}, except that it takes any number | 2611 | This macro is like @code{cl-proclaim}, except that it takes any number |
| 2609 | of @var{decl-spec} arguments, and the arguments are unevaluated and | 2612 | of @var{decl-spec} arguments, and the arguments are unevaluated and |
| 2610 | unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when | 2613 | unquoted. 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 |
| 2612 | be registered at compile-time as well as at run-time. (This is vital, | 2615 | be registered at compile-time as well as at run-time. (This is vital, |
| 2613 | since normally the declarations are meant to influence the way the | 2616 | since normally the declarations are meant to influence the way the |
| 2614 | compiler treats the rest of the file that contains the @code{cl-declaim} | 2617 | compiler 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 | |||
| 2826 | pair onto the list if the property is not yet present. | 2829 | pair 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 | ||
| 2832 | The @code{get} and @code{cl-get} functions are also @code{setf}-able. | 2835 | The @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 | |||
| 3198 | function of one argument. This key function is used as a filter | 3201 | function of one argument. This key function is used as a filter |
| 3199 | through which the elements of the sequence are seen; for example, | 3202 | through 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)}: |
| 3201 | It searches for an element of the list whose @code{car} equals | 3204 | It 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. |
| 3203 | If @code{:key} is omitted or @code{nil}, the filter is effectively | 3206 | If @code{:key} is omitted or @code{nil}, the filter is effectively |
| 3204 | the identity function. | 3207 | the 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 |
| 3302 | This function calls @var{function} on each of its argument lists, | 3305 | This function calls @var{function} on each of its argument lists, |
| 3303 | then on the @code{cdr}s of those lists, and so on, until the | 3306 | then on the @sc{cdr}s of those lists, and so on, until the |
| 3304 | shortest list runs out. The results are returned in the form | 3307 | shortest list runs out. The results are returned in the form |
| 3305 | of a list. Thus, @code{cl-maplist} is like @code{cl-mapcar} except | 3308 | of a list. Thus, @code{cl-maplist} is like @code{cl-mapcar} except |
| 3306 | that it passes in the list pointers themselves rather than the | 3309 | that 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 | |||
| 3630 | implementation. | 3633 | implementation. |
| 3631 | 3634 | ||
| 3632 | The @code{cl-sort} function is destructive; it sorts lists by actually | 3635 | The @code{cl-sort} function is destructive; it sorts lists by actually |
| 3633 | rearranging the @code{cdr} pointers in suitable fashion. | 3636 | rearranging 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 |
| 3709 | This function returns the length of list @var{x}, exactly like | 3712 | This 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 |
| 3711 | list (where the cdr-chain forms a loop rather than terminating | 3714 | list (where the @sc{cdr}-chain forms a loop rather than terminating |
| 3712 | with @code{nil}), this function returns @code{nil}. (The regular | 3715 | with @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 |
| 3717 | This function constructs a list of its arguments. The final | 3720 | This function constructs a list of its arguments. The final |
| 3718 | argument becomes the @code{cdr} of the last cell constructed. | 3721 | argument becomes the @sc{cdr} of the last cell constructed. |
| 3719 | Thus, @code{(cl-list* @var{a} @var{b} @var{c})} is equivalent to | 3722 | Thus, @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. | |||
| 3742 | This function returns a copy of the tree of cons cells @var{x}. | 3745 | This 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. |
| 3744 | Unlike @code{copy-sequence} (and its alias @code{cl-copy-list}), | 3747 | Unlike @code{copy-sequence} (and its alias @code{cl-copy-list}), |
| 3745 | which copies only along the @code{cdr} direction, this function | 3748 | which copies only along the @sc{cdr} direction, this function |
| 3746 | copies (recursively) along both the @code{car} and the @code{cdr} | 3749 | copies (recursively) along both the @sc{car} and the @sc{cdr} |
| 3747 | directions. If @var{x} is not a cons cell, the function simply | 3750 | directions. If @var{x} is not a cons cell, the function simply |
| 3748 | returns @var{x} unchanged. If the optional @var{vecp} argument | 3751 | returns @var{x} unchanged. If the optional @var{vecp} argument |
| 3749 | is true, this function copies vectors (recursively) as well as | 3752 | is 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} |
| 3754 | This function compares two trees of cons cells. If @var{x} and | 3757 | This 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 |
| 3756 | compared recursively. If neither @var{x} nor @var{y} is a cons | 3759 | compared recursively. If neither @var{x} nor @var{y} is a cons |
| 3757 | cell, they are compared by @code{eql}, or according to the | 3760 | cell, they are compared by @code{eql}, or according to the |
| 3758 | specified test. The @code{:key} function, if specified, is | 3761 | specified test. The @code{:key} function, if specified, is |
| @@ -3773,7 +3776,7 @@ in @var{tree}, a tree of cons cells. It returns a substituted | |||
| 3773 | tree, which will be a copy except that it may share storage with | 3776 | tree, which will be a copy except that it may share storage with |
| 3774 | the argument @var{tree} in parts where no substitutions occurred. | 3777 | the argument @var{tree} in parts where no substitutions occurred. |
| 3775 | The original @var{tree} is not modified. This function recurses | 3778 | The original @var{tree} is not modified. This function recurses |
| 3776 | on, and compares against @var{old}, both @code{car}s and @code{cdr}s | 3779 | on, and compares against @var{old}, both @sc{car}s and @sc{cdr}s |
| 3777 | of the component cons cells. If @var{old} is itself a cons cell, | 3780 | of the component cons cells. If @var{old} is itself a cons cell, |
| 3778 | then matching cells in the tree are substituted as usual without | 3781 | then matching cells in the tree are substituted as usual without |
| 3779 | recursively substituting in that cell. Comparisons with @var{old} | 3782 | recursively 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 | |||
| 3799 | This function is like @code{cl-subst}, except that it takes an | 3802 | This function is like @code{cl-subst}, except that it takes an |
| 3800 | association list @var{alist} of @var{old}-@var{new} pairs. | 3803 | association list @var{alist} of @var{old}-@var{new} pairs. |
| 3801 | Each element of the tree (after applying the @code{:key} | 3804 | Each element of the tree (after applying the @code{:key} |
| 3802 | function, if any), is compared with the @code{car}s of | 3805 | function, 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} |
| 3819 | This function searches @var{list} for an element matching @var{item}. | 3822 | This function searches @var{list} for an element matching @var{item}. |
| 3820 | If a match is found, it returns the cons cell whose @code{car} was | 3823 | If a match is found, it returns the cons cell whose @sc{car} was |
| 3821 | the matching element. Otherwise, it returns @code{nil}. Elements | 3824 | the matching element. Otherwise, it returns @code{nil}. Elements |
| 3822 | are compared by @code{eql} by default; you can use the @code{:test}, | 3825 | are 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 |
| 3837 | This function returns @code{t} if @var{sublist} is a sublist of | 3840 | This 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 |
| 3839 | any of its @code{cdr}s. | 3842 | any 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} |
| 3918 | This function searches the association list @var{a-list} for an | 3921 | This function searches the association list @var{a-list} for an |
| 3919 | element whose @code{car} matches (in the sense of @code{:test}, | 3922 | element 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}) |
| 3921 | a given @var{item}. It returns the matching element, if any, | 3924 | a given @var{item}. It returns the matching element, if any, |
| 3922 | otherwise @code{nil}. It ignores elements of @var{a-list} which | 3925 | otherwise @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} |
| 3930 | This function searches for an element whose @code{cdr} matches | 3933 | This 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 |
| 3932 | the inverse of the mapping to @var{item}. | 3935 | the 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 |
| 4610 | Other syntactic features. Common Lisp provides a number of | 4613 | Other syntactic features. Common Lisp provides a number of |
| 4611 | notations beginning with @code{#} that the Emacs Lisp parser | 4614 | notations beginning with @code{#} that the Emacs Lisp parser |
| 4612 | won't understand. For example, @samp{#| ... |#} is an | 4615 | won't understand. For example, @samp{#| @dots{} |#} is an |
| 4613 | alternate comment notation, and @samp{#+lucid (foo)} tells | 4616 | alternate comment notation, and @samp{#+lucid (foo)} tells |
| 4614 | the parser to ignore the @code{(foo)} except in Lucid Common | 4617 | the parser to ignore the @code{(foo)} except in Lucid Common |
| 4615 | Lisp. | 4618 | Lisp. |
| @@ -4659,7 +4662,7 @@ While it would have been possible to implement most of Common | |||
| 4659 | Lisp @code{format} in this package (under the name @code{cl-format}, | 4662 | Lisp @code{format} in this package (under the name @code{cl-format}, |
| 4660 | of course), it was not deemed worthwhile. It would have required | 4663 | of course), it was not deemed worthwhile. It would have required |
| 4661 | a huge amount of code to implement even a decent subset of | 4664 | a 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 |
| 4663 | Emacs Lisp's @code{format} would rarely be useful. | 4666 | Emacs 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 | |||
| 4725 | these forms: | 4728 | these 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 | ||
| 4732 | While this would be mainly a stylistic choice in most Common Lisps, | 4735 | While 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 | |||
| 4888 | directly inside the @code{flet} form itself. | 4891 | directly inside the @code{flet} form itself. |
| 4889 | 4892 | ||
| 4890 | @c Bug#411. | 4893 | @c Bug#411. |
| 4891 | Note that many primitives (e.g. @code{+}) have special byte-compile | 4894 | Note that many primitives (e.g.@: @code{+}) have special byte-compile |
| 4892 | handling. Attempts to redefine such functions using @code{flet} will | 4895 | handling. Attempts to redefine such functions using @code{flet} will |
| 4893 | fail if byte-compiled. | 4896 | fail 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 | |||
| 4930 | described by @var{arglist}. The call | 4933 | described 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 |
| 4937 | will be expanded to | 4940 | will 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 |
| 4944 | which in turn is roughly equivalent to | 4947 | which 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 | ||
| 4950 | For example: | 4953 | For example: |