diff options
| author | Dave Love | 2000-09-12 17:44:45 +0000 |
|---|---|---|
| committer | Dave Love | 2000-09-12 17:44:45 +0000 |
| commit | c6ad01e8537f0e25e78b85beba56a673919a5df7 (patch) | |
| tree | aa467f835b43ee8555188949244d6655dcb2eec2 | |
| parent | d12d0a9b791ed9c1959f98d7978c18644e9d438e (diff) | |
| download | emacs-c6ad01e8537f0e25e78b85beba56a673919a5df7.tar.gz emacs-c6ad01e8537f0e25e78b85beba56a673919a5df7.zip | |
Remove obsolescences, especially hash tables and refs to Emacs 19.
| -rw-r--r-- | man/cl.texi | 311 |
1 files changed, 48 insertions, 263 deletions
diff --git a/man/cl.texi b/man/cl.texi index 2bb30b3d792..8788e66a014 100644 --- a/man/cl.texi +++ b/man/cl.texi | |||
| @@ -79,7 +79,7 @@ included in a translation approved by the author instead of in the | |||
| 79 | original English. | 79 | original English. |
| 80 | @end titlepage | 80 | @end titlepage |
| 81 | 81 | ||
| 82 | @node Top, Overview,, (dir) | 82 | @node Top, Overview, (dir), (dir) |
| 83 | @chapter Common Lisp Extensions | 83 | @chapter Common Lisp Extensions |
| 84 | 84 | ||
| 85 | @noindent | 85 | @noindent |
| @@ -99,7 +99,6 @@ does assume a basic familiarity with Emacs Lisp. | |||
| 99 | * Numbers:: Predicates, functions, random numbers | 99 | * Numbers:: Predicates, functions, random numbers |
| 100 | * Sequences:: Mapping, functions, searching, sorting | 100 | * Sequences:: Mapping, functions, searching, sorting |
| 101 | * Lists:: `cadr', `sublis', `member*', `assoc*', etc. | 101 | * Lists:: `cadr', `sublis', `member*', `assoc*', etc. |
| 102 | * Hash Tables:: `make-hash-table', `gethash', etc. | ||
| 103 | * Structures:: `defstruct' | 102 | * Structures:: `defstruct' |
| 104 | * Assertions:: `check-type', `assert', `ignore-errors'. | 103 | * Assertions:: `check-type', `assert', `ignore-errors'. |
| 105 | 104 | ||
| @@ -271,11 +270,11 @@ Info files in the @file{info/} directory or another suitable place. | |||
| 271 | 270 | ||
| 272 | You may instead wish to leave this package's components all in | 271 | You may instead wish to leave this package's components all in |
| 273 | their own directory, and then add this directory to your | 272 | their own directory, and then add this directory to your |
| 274 | @code{load-path} and (Emacs 19 only) @code{Info-directory-list}. | 273 | @code{load-path} and @code{Info-directory-list}. |
| 275 | Add the directory to the front of the list so the old @dfn{CL} | 274 | Add the directory to the front of the list so the old @dfn{CL} |
| 276 | package and its documentation are hidden. | 275 | package and its documentation are hidden. |
| 277 | 276 | ||
| 278 | @node Naming Conventions, , Installation, Overview | 277 | @node Naming Conventions, , Installation, Overview |
| 279 | @section Naming Conventions | 278 | @section Naming Conventions |
| 280 | 279 | ||
| 281 | @noindent | 280 | @noindent |
| @@ -300,17 +299,11 @@ by @code{cl-}. Here is a complete list of functions @emph{not} | |||
| 300 | prefixed by @code{cl-} which were not taken from Common Lisp: | 299 | prefixed by @code{cl-} which were not taken from Common Lisp: |
| 301 | 300 | ||
| 302 | @example | 301 | @example |
| 303 | member remove remq | ||
| 304 | floatp-safe lexical-let lexical-let* | 302 | floatp-safe lexical-let lexical-let* |
| 305 | callf callf2 letf letf* | 303 | callf callf2 letf letf* |
| 306 | defsubst* defalias add-hook eval-when-compile | 304 | defsubst* |
| 307 | @end example | 305 | @end example |
| 308 | 306 | ||
| 309 | @noindent | ||
| 310 | (Most of these are Emacs 19 features provided to Emacs 18 users, | ||
| 311 | or introduced, like @code{remq}, for reasons of symmetry | ||
| 312 | with similar features.) | ||
| 313 | |||
| 314 | The following simple functions and macros are defined in @file{cl.el}; | 307 | The following simple functions and macros are defined in @file{cl.el}; |
| 315 | they do not cause other components like @file{cl-extra} to be loaded. | 308 | they do not cause other components like @file{cl-extra} to be loaded. |
| 316 | 309 | ||
| @@ -350,7 +343,6 @@ and the @code{eval-when} construct. | |||
| 350 | @menu | 343 | @menu |
| 351 | * Argument Lists:: `&key', `&aux', `defun*', `defmacro*'. | 344 | * Argument Lists:: `&key', `&aux', `defun*', `defmacro*'. |
| 352 | * Time of Evaluation:: The `eval-when' construct. | 345 | * Time of Evaluation:: The `eval-when' construct. |
| 353 | * Function Aliases:: The `defalias' function. | ||
| 354 | @end menu | 346 | @end menu |
| 355 | 347 | ||
| 356 | @iftex | 348 | @iftex |
| @@ -383,7 +375,7 @@ called @var{name}; @pxref{Blocks and Exits}. | |||
| 383 | This is just like @code{defun*}, except that the function that | 375 | This is just like @code{defun*}, except that the function that |
| 384 | is defined is automatically proclaimed @code{inline}, i.e., | 376 | is defined is automatically proclaimed @code{inline}, i.e., |
| 385 | calls to it may be expanded into in-line code by the byte compiler. | 377 | calls to it may be expanded into in-line code by the byte compiler. |
| 386 | This is analogous to the @code{defsubst} form in Emacs 19; | 378 | This is analogous to the @code{defsubst} form; |
| 387 | @code{defsubst*} uses a different method (compiler macros) which | 379 | @code{defsubst*} uses a different method (compiler macros) which |
| 388 | works in all version of Emacs, and also generates somewhat more | 380 | works in all version of Emacs, and also generates somewhat more |
| 389 | efficient inline expansions. In particular, @code{defsubst*} | 381 | efficient inline expansions. In particular, @code{defsubst*} |
| @@ -583,7 +575,7 @@ If the optimization quality @code{safety} is set to 0 | |||
| 583 | arguments and invalid keyword arguments is disabled. By default, | 575 | arguments and invalid keyword arguments is disabled. By default, |
| 584 | argument lists are rigorously checked. | 576 | argument lists are rigorously checked. |
| 585 | 577 | ||
| 586 | @node Time of Evaluation, Function Aliases, Argument Lists, Program Structure | 578 | @node Time of Evaluation, , Argument Lists, Program Structure |
| 587 | @section Time of Evaluation | 579 | @section Time of Evaluation |
| 588 | 580 | ||
| 589 | @noindent | 581 | @noindent |
| @@ -671,7 +663,7 @@ certain top-level forms, like @code{defmacro} (sort-of) and | |||
| 671 | (compile load eval) @dots{})}. | 663 | (compile load eval) @dots{})}. |
| 672 | @end defspec | 664 | @end defspec |
| 673 | 665 | ||
| 674 | Emacs 19 includes two special forms related to @code{eval-when}. | 666 | Emacs includes two special forms related to @code{eval-when}. |
| 675 | One of these, @code{eval-when-compile}, is not quite equivalent to | 667 | One of these, @code{eval-when-compile}, is not quite equivalent to |
| 676 | any @code{eval-when} construct and is described below. | 668 | any @code{eval-when} construct and is described below. |
| 677 | 669 | ||
| @@ -733,23 +725,6 @@ Byte-compiled, the above defun will result in the following code | |||
| 733 | @end example | 725 | @end example |
| 734 | @end defspec | 726 | @end defspec |
| 735 | 727 | ||
| 736 | @node Function Aliases, , Time of Evaluation, Program Structure | ||
| 737 | @section Function Aliases | ||
| 738 | |||
| 739 | @noindent | ||
| 740 | This section describes a feature from GNU Emacs 19 which this | ||
| 741 | package makes available in other versions of Emacs. | ||
| 742 | |||
| 743 | @defun defalias symbol function | ||
| 744 | This function sets @var{symbol}'s function cell to @var{function}. | ||
| 745 | It is equivalent to @code{fset}, except that in GNU Emacs 19 it also | ||
| 746 | records the setting in @code{load-history} so that it can be undone | ||
| 747 | by a later @code{unload-feature}. | ||
| 748 | |||
| 749 | In other versions of Emacs, @code{defalias} is a synonym for | ||
| 750 | @code{fset}. | ||
| 751 | @end defun | ||
| 752 | |||
| 753 | @node Predicates, Control Structure, Program Structure, Top | 728 | @node Predicates, Control Structure, Program Structure, Top |
| 754 | @chapter Predicates | 729 | @chapter Predicates |
| 755 | 730 | ||
| @@ -890,7 +865,7 @@ names. @xref{Conditionals}. @xref{Assertions}. The @code{map}, | |||
| 890 | @code{concatenate}, and @code{merge} functions take type-name | 865 | @code{concatenate}, and @code{merge} functions take type-name |
| 891 | arguments to specify the type of sequence to return. @xref{Sequences}. | 866 | arguments to specify the type of sequence to return. @xref{Sequences}. |
| 892 | 867 | ||
| 893 | @node Equality Predicates, , Type Predicates, Predicates | 868 | @node Equality Predicates, , Type Predicates, Predicates |
| 894 | @section Equality Predicates | 869 | @section Equality Predicates |
| 895 | 870 | ||
| 896 | @noindent | 871 | @noindent |
| @@ -902,7 +877,7 @@ This function is almost the same as @code{eq}, except that if @var{a} | |||
| 902 | and @var{b} are numbers of the same type, it compares them for numeric | 877 | and @var{b} are numbers of the same type, it compares them for numeric |
| 903 | equality (as if by @code{equal} instead of @code{eq}). This makes a | 878 | equality (as if by @code{equal} instead of @code{eq}). This makes a |
| 904 | difference only for versions of Emacs that are compiled with | 879 | difference only for versions of Emacs that are compiled with |
| 905 | floating-point support, such as Emacs 19. Emacs floats are allocated | 880 | floating-point support. Emacs floats are allocated |
| 906 | objects just like cons cells, which means that @code{(eq 3.0 3.0)} | 881 | objects just like cons cells, which means that @code{(eq 3.0 3.0)} |
| 907 | will not necessarily be true---if the two @code{3.0}s were allocated | 882 | will not necessarily be true---if the two @code{3.0}s were allocated |
| 908 | separately, the pointers will be different even though the numbers are | 883 | separately, the pointers will be different even though the numbers are |
| @@ -942,11 +917,7 @@ respects. First, Common Lisp's @code{equalp} also compares | |||
| 942 | in this package since Emacs does not distinguish between integers | 917 | in this package since Emacs does not distinguish between integers |
| 943 | and characters. In keeping with the idea that strings are less | 918 | and characters. In keeping with the idea that strings are less |
| 944 | vector-like in Emacs Lisp, this package's @code{equalp} also will | 919 | vector-like in Emacs Lisp, this package's @code{equalp} also will |
| 945 | not compare strings against vectors of integers. Finally, Common | 920 | not compare strings against vectors of integers. |
| 946 | Lisp's @code{equalp} compares hash tables without regard to | ||
| 947 | ordering, whereas this package simply compares hash tables in | ||
| 948 | terms of their underlying structure (which means vectors for Lucid | ||
| 949 | Emacs 19 hash tables, or lists for other hash tables). | ||
| 950 | @end defun | 921 | @end defun |
| 951 | 922 | ||
| 952 | Also note that the Common Lisp functions @code{member} and @code{assoc} | 923 | Also note that the Common Lisp functions @code{member} and @code{assoc} |
| @@ -1091,7 +1062,6 @@ to standard Common Lisp. | |||
| 1091 | 1062 | ||
| 1092 | @item | 1063 | @item |
| 1093 | The following Emacs-specific functions are also @code{setf}-able. | 1064 | The following Emacs-specific functions are also @code{setf}-able. |
| 1094 | (Some of these are defined only in Emacs 19 or only in Lucid Emacs.) | ||
| 1095 | 1065 | ||
| 1096 | @smallexample | 1066 | @smallexample |
| 1097 | buffer-file-name marker-position | 1067 | buffer-file-name marker-position |
| @@ -1424,7 +1394,7 @@ blocks for other macros like @code{incf}, @code{pushnew}, and | |||
| 1424 | macros are used in the processing of symbol macros; | 1394 | macros are used in the processing of symbol macros; |
| 1425 | @pxref{Macro Bindings}. | 1395 | @pxref{Macro Bindings}. |
| 1426 | 1396 | ||
| 1427 | @node Customizing Setf, , Modify Macros, Generalized Variables | 1397 | @node Customizing Setf, , Modify Macros, Generalized Variables |
| 1428 | @subsection Customizing Setf | 1398 | @subsection Customizing Setf |
| 1429 | 1399 | ||
| 1430 | @noindent | 1400 | @noindent |
| @@ -1859,7 +1829,7 @@ function, or a use of its name quoted by @code{quote} or | |||
| 1859 | @code{function} to be passed on to, say, @code{mapcar}. | 1829 | @code{function} to be passed on to, say, @code{mapcar}. |
| 1860 | @end defspec | 1830 | @end defspec |
| 1861 | 1831 | ||
| 1862 | @node Macro Bindings, , Function Bindings, Variable Bindings | 1832 | @node Macro Bindings, , Function Bindings, Variable Bindings |
| 1863 | @subsection Macro Bindings | 1833 | @subsection Macro Bindings |
| 1864 | 1834 | ||
| 1865 | @noindent | 1835 | @noindent |
| @@ -2064,8 +2034,8 @@ just as in Common Lisp. | |||
| 2064 | Because they are implemented in terms of Emacs Lisp @code{catch} | 2034 | Because they are implemented in terms of Emacs Lisp @code{catch} |
| 2065 | and @code{throw}, blocks have the same overhead as actual | 2035 | and @code{throw}, blocks have the same overhead as actual |
| 2066 | @code{catch} constructs (roughly two function calls). However, | 2036 | @code{catch} constructs (roughly two function calls). However, |
| 2067 | Zawinski and Furuseth's optimizing byte compiler (standard in | 2037 | the optimizing byte compiler will optimize away the @code{catch} |
| 2068 | Emacs 19) will optimize away the @code{catch} if the block does | 2038 | if the block does |
| 2069 | not in fact contain any @code{return} or @code{return-from} calls | 2039 | not in fact contain any @code{return} or @code{return-from} calls |
| 2070 | that jump to it. This means that @code{do} loops and @code{defun*} | 2040 | that jump to it. This means that @code{do} loops and @code{defun*} |
| 2071 | functions which don't use @code{return} don't pay the overhead to | 2041 | functions which don't use @code{return} don't pay the overhead to |
| @@ -2562,11 +2532,8 @@ is the opposite word of the word following @code{the}) to cause | |||
| 2562 | hash table entry. | 2532 | hash table entry. |
| 2563 | 2533 | ||
| 2564 | @item for @var{var} being the key-codes of @var{keymap} | 2534 | @item for @var{var} being the key-codes of @var{keymap} |
| 2565 | This clause iterates over the entries in @var{keymap}. In GNU Emacs | 2535 | This clause iterates over the entries in @var{keymap}. |
| 2566 | 18 and 19, keymaps are either alists or vectors, and key-codes are | 2536 | The iteration does not enter nested keymaps or inherited (parent) keymaps. |
| 2567 | integers or symbols. In Lucid Emacs 19, keymaps are a special new | ||
| 2568 | data type, and key-codes are symbols or lists of symbols. The | ||
| 2569 | iteration does not enter nested keymaps or inherited (parent) keymaps. | ||
| 2570 | You can use @samp{the key-bindings} to access the commands bound to | 2537 | You can use @samp{the key-bindings} to access the commands bound to |
| 2571 | the keys rather than the key codes, and you can add a @code{using} | 2538 | the keys rather than the key codes, and you can add a @code{using} |
| 2572 | clause to access both the codes and the bindings together. | 2539 | clause to access both the codes and the bindings together. |
| @@ -2580,8 +2547,8 @@ them permanently. You can add a @samp{using (key-bindings ...)} | |||
| 2580 | clause to get the command bindings as well. | 2547 | clause to get the command bindings as well. |
| 2581 | 2548 | ||
| 2582 | @item for @var{var} being the overlays [of @var{buffer}] @dots{} | 2549 | @item for @var{var} being the overlays [of @var{buffer}] @dots{} |
| 2583 | This clause iterates over the Emacs 19 ``overlays'' or Lucid | 2550 | This clause iterates over the ``overlays'' of a buffer |
| 2584 | Emacs ``extents'' of a buffer (the clause @code{extents} is synonymous | 2551 | (the clause @code{extents} is synonymous |
| 2585 | with @code{overlays}). If the @code{of} term is omitted, the current | 2552 | with @code{overlays}). If the @code{of} term is omitted, the current |
| 2586 | buffer is used. | 2553 | buffer is used. |
| 2587 | This clause also accepts optional @samp{from @var{pos}} and | 2554 | This clause also accepts optional @samp{from @var{pos}} and |
| @@ -2595,13 +2562,11 @@ of start and end positions, where one start position is always equal | |||
| 2595 | to the previous end position. The clause allows @code{of}, | 2562 | to the previous end position. The clause allows @code{of}, |
| 2596 | @code{from}, @code{to}, and @code{property} terms, where the latter | 2563 | @code{from}, @code{to}, and @code{property} terms, where the latter |
| 2597 | term restricts the search to just the specified property. The | 2564 | term restricts the search to just the specified property. The |
| 2598 | @code{of} term may specify either a buffer or a string. This | 2565 | @code{of} term may specify either a buffer or a string. |
| 2599 | clause is useful only in GNU Emacs 19; in other versions, all | ||
| 2600 | buffers and strings consist of a single interval. | ||
| 2601 | 2566 | ||
| 2602 | @item for @var{var} being the frames | 2567 | @item for @var{var} being the frames |
| 2603 | This clause iterates over all frames, i.e., X window system windows | 2568 | This clause iterates over all frames, i.e., X window system windows |
| 2604 | open on Emacs files. This clause works only under Emacs 19. The | 2569 | open on Emacs files. The |
| 2605 | clause @code{screens} is a synonym for @code{frames}. The frames | 2570 | clause @code{screens} is a synonym for @code{frames}. The frames |
| 2606 | are visited in @code{next-frame} order starting from | 2571 | are visited in @code{next-frame} order starting from |
| 2607 | @code{selected-frame}. | 2572 | @code{selected-frame}. |
| @@ -2809,7 +2774,7 @@ accumulate into the same place. From Steele: | |||
| 2809 | @result{} (fred bob ken sue alice joe kris sunshine june) | 2774 | @result{} (fred bob ken sue alice joe kris sunshine june) |
| 2810 | @end example | 2775 | @end example |
| 2811 | 2776 | ||
| 2812 | @node Other Clauses, , Accumulation Clauses, Loop Facility | 2777 | @node Other Clauses, , Accumulation Clauses, Loop Facility |
| 2813 | @subsection Other Clauses | 2778 | @subsection Other Clauses |
| 2814 | 2779 | ||
| 2815 | @noindent | 2780 | @noindent |
| @@ -2960,7 +2925,7 @@ and data-type specifiers. Naturally, the @code{for} clauses which | |||
| 2960 | iterate over keymaps, overlays, intervals, frames, windows, and | 2925 | iterate over keymaps, overlays, intervals, frames, windows, and |
| 2961 | buffers are Emacs-specific extensions. | 2926 | buffers are Emacs-specific extensions. |
| 2962 | 2927 | ||
| 2963 | @node Multiple Values, , Loop Facility, Control Structure | 2928 | @node Multiple Values, , Loop Facility, Control Structure |
| 2964 | @section Multiple Values | 2929 | @section Multiple Values |
| 2965 | 2930 | ||
| 2966 | @noindent | 2931 | @noindent |
| @@ -3096,7 +3061,7 @@ Most of the Common Lisp declarations are not currently useful in | |||
| 3096 | Emacs Lisp, as the byte-code system provides little opportunity | 3061 | Emacs Lisp, as the byte-code system provides little opportunity |
| 3097 | to benefit from type information, and @code{special} declarations | 3062 | to benefit from type information, and @code{special} declarations |
| 3098 | are redundant in a fully dynamically-scoped Lisp. A few | 3063 | are redundant in a fully dynamically-scoped Lisp. A few |
| 3099 | declarations are meaningful when the optimizing Emacs 19 byte | 3064 | declarations are meaningful when the optimizing byte |
| 3100 | compiler is being used, however. Under the earlier non-optimizing | 3065 | compiler is being used, however. Under the earlier non-optimizing |
| 3101 | compiler, these declarations will effectively be ignored. | 3066 | compiler, these declarations will effectively be ignored. |
| 3102 | 3067 | ||
| @@ -3187,14 +3152,12 @@ function call. | |||
| 3187 | 3152 | ||
| 3188 | The following declarations are all equivalent. Note that the | 3153 | The following declarations are all equivalent. Note that the |
| 3189 | @code{defsubst} form is a convenient way to define a function | 3154 | @code{defsubst} form is a convenient way to define a function |
| 3190 | and declare it inline all at once, but it is available only in | 3155 | and declare it inline all at once. |
| 3191 | Emacs 19. | ||
| 3192 | 3156 | ||
| 3193 | @example | 3157 | @example |
| 3194 | (declaim (inline foo bar)) | 3158 | (declaim (inline foo bar)) |
| 3195 | (eval-when (compile load eval) (proclaim '(inline foo bar))) | 3159 | (eval-when (compile load eval) (proclaim '(inline foo bar))) |
| 3196 | (proclaim-inline foo bar) ; Lucid Emacs only | 3160 | (defsubst foo (...) ...) ; instead of defun |
| 3197 | (defsubst foo (...) ...) ; instead of defun; Emacs 19 only | ||
| 3198 | @end example | 3161 | @end example |
| 3199 | 3162 | ||
| 3200 | @strong{Note:} This declaration remains in effect after the | 3163 | @strong{Note:} This declaration remains in effect after the |
| @@ -3226,7 +3189,7 @@ and @code{safety}. The value of a quality should be an integer from | |||
| 3226 | 0 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important.'' | 3189 | 0 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important.'' |
| 3227 | The default level for both qualities is 1. | 3190 | The default level for both qualities is 1. |
| 3228 | 3191 | ||
| 3229 | In this package, with the Emacs 19 optimizing compiler, the | 3192 | In this package, with the optimizing compiler, the |
| 3230 | @code{speed} quality is tied to the @code{byte-compile-optimize} | 3193 | @code{speed} quality is tied to the @code{byte-compile-optimize} |
| 3231 | flag, which is set to @code{nil} for @code{(speed 0)} and to | 3194 | flag, which is set to @code{nil} for @code{(speed 0)} and to |
| 3232 | @code{t} for higher settings; and the @code{safety} quality is | 3195 | @code{t} for higher settings; and the @code{safety} quality is |
| @@ -3361,7 +3324,7 @@ out the property and value cells. | |||
| 3361 | @secno=2 | 3324 | @secno=2 |
| 3362 | @end iftex | 3325 | @end iftex |
| 3363 | 3326 | ||
| 3364 | @node Creating Symbols, , Property Lists, Symbols | 3327 | @node Creating Symbols, , Property Lists, Symbols |
| 3365 | @section Creating Symbols | 3328 | @section Creating Symbols |
| 3366 | 3329 | ||
| 3367 | @noindent | 3330 | @noindent |
| @@ -3492,14 +3455,14 @@ square root of the argument. | |||
| 3492 | @defun floor* number &optional divisor | 3455 | @defun floor* number &optional divisor |
| 3493 | This function implements the Common Lisp @code{floor} function. | 3456 | This function implements the Common Lisp @code{floor} function. |
| 3494 | It is called @code{floor*} to avoid name conflicts with the | 3457 | It is called @code{floor*} to avoid name conflicts with the |
| 3495 | simpler @code{floor} function built-in to Emacs 19. | 3458 | simpler @code{floor} function built-in to Emacs. |
| 3496 | 3459 | ||
| 3497 | With one argument, @code{floor*} returns a list of two numbers: | 3460 | With one argument, @code{floor*} returns a list of two numbers: |
| 3498 | The argument rounded down (toward minus infinity) to an integer, | 3461 | The argument rounded down (toward minus infinity) to an integer, |
| 3499 | and the ``remainder'' which would have to be added back to the | 3462 | and the ``remainder'' which would have to be added back to the |
| 3500 | first return value to yield the argument again. If the argument | 3463 | first return value to yield the argument again. If the argument |
| 3501 | is an integer @var{x}, the result is always the list @code{(@var{x} 0)}. | 3464 | is an integer @var{x}, the result is always the list @code{(@var{x} 0)}. |
| 3502 | If the argument is an Emacs 19 floating-point number, the first | 3465 | If the argument is a floating-point number, the first |
| 3503 | result is a Lisp integer and the second is a Lisp float between | 3466 | result is a Lisp integer and the second is a Lisp float between |
| 3504 | 0 (inclusive) and 1 (exclusive). | 3467 | 0 (inclusive) and 1 (exclusive). |
| 3505 | 3468 | ||
| @@ -3554,7 +3517,7 @@ of @code{truncate}. | |||
| 3554 | These definitions are compatible with those in the Quiroz | 3517 | These definitions are compatible with those in the Quiroz |
| 3555 | @file{cl.el} package, except that this package appends @samp{*} | 3518 | @file{cl.el} package, except that this package appends @samp{*} |
| 3556 | to certain function names to avoid conflicts with existing | 3519 | to certain function names to avoid conflicts with existing |
| 3557 | Emacs 19 functions, and that the mechanism for returning | 3520 | Emacs functions, and that the mechanism for returning |
| 3558 | multiple values is different. | 3521 | multiple values is different. |
| 3559 | 3522 | ||
| 3560 | @iftex | 3523 | @iftex |
| @@ -3622,7 +3585,7 @@ This predicate returns @code{t} if @var{object} is a | |||
| 3622 | @code{random-state} object, or @code{nil} otherwise. | 3585 | @code{random-state} object, or @code{nil} otherwise. |
| 3623 | @end defun | 3586 | @end defun |
| 3624 | 3587 | ||
| 3625 | @node Implementation Parameters, , Random Numbers, Numbers | 3588 | @node Implementation Parameters, , Random Numbers, Numbers |
| 3626 | @section Implementation Parameters | 3589 | @section Implementation Parameters |
| 3627 | 3590 | ||
| 3628 | @noindent | 3591 | @noindent |
| @@ -3645,12 +3608,12 @@ might be slow, the code for initializing them is kept in a separate | |||
| 3645 | function that must be called before the parameters can be used. | 3608 | function that must be called before the parameters can be used. |
| 3646 | 3609 | ||
| 3647 | @defun cl-float-limits | 3610 | @defun cl-float-limits |
| 3648 | This function makes sure that the Common Lisp floating-point | 3611 | This function makes sure that the Common Lisp floating-point parameters |
| 3649 | parameters like @code{most-positive-float} have been initialized. | 3612 | like @code{most-positive-float} have been initialized. Until it is |
| 3650 | Until it is called, these parameters will be @code{nil}. If this | 3613 | called, these parameters will be @code{nil}. If this version of Emacs |
| 3651 | version of Emacs does not support floats (e.g., most versions of | 3614 | does not support floats, the parameters will remain @code{nil}. If the |
| 3652 | Emacs 18), the parameters will remain @code{nil}. If the parameters | 3615 | parameters have already been initialized, the function returns |
| 3653 | have already been initialized, the function returns immediately. | 3616 | immediately. |
| 3654 | 3617 | ||
| 3655 | The algorithm makes assumptions that will be valid for most modern | 3618 | The algorithm makes assumptions that will be valid for most modern |
| 3656 | machines, but will fail if the machine's arithmetic is extremely | 3619 | machines, but will fail if the machine's arithmetic is extremely |
| @@ -3804,7 +3767,7 @@ backwards. (Some functions, like @code{mapcar*} and @code{every}, | |||
| 3804 | @emph{do} specify exactly the order in which the function is called | 3767 | @emph{do} specify exactly the order in which the function is called |
| 3805 | so side effects are perfectly acceptable in those cases.) | 3768 | so side effects are perfectly acceptable in those cases.) |
| 3806 | 3769 | ||
| 3807 | Strings in GNU Emacs 19 may contain ``text properties'' as well | 3770 | Strings may contain ``text properties'' as well |
| 3808 | as character data. Except as noted, it is undefined whether or | 3771 | as character data. Except as noted, it is undefined whether or |
| 3809 | not text properties are preserved by sequence functions. For | 3772 | not text properties are preserved by sequence functions. For |
| 3810 | example, @code{(remove* ?A @var{str})} may or may not preserve | 3773 | example, @code{(remove* ?A @var{str})} may or may not preserve |
| @@ -4039,20 +4002,6 @@ non-destructive and destructive list operations in Emacs Lisp. | |||
| 4039 | The predicate-oriented functions @code{remove-if}, @code{remove-if-not}, | 4002 | The predicate-oriented functions @code{remove-if}, @code{remove-if-not}, |
| 4040 | @code{delete-if}, and @code{delete-if-not} are defined similarly. | 4003 | @code{delete-if}, and @code{delete-if-not} are defined similarly. |
| 4041 | 4004 | ||
| 4042 | @defun remove item list | ||
| 4043 | This function removes from @var{list} all elements which are | ||
| 4044 | @code{equal} to @var{item}. This package defines it for symmetry | ||
| 4045 | with @code{delete}, even though @code{remove} is not built-in to | ||
| 4046 | Emacs 19. | ||
| 4047 | @end defun | ||
| 4048 | |||
| 4049 | @defun remq item list | ||
| 4050 | This function removes from @var{list} all elements which are | ||
| 4051 | @code{eq} to @var{item}. This package defines it for symmetry | ||
| 4052 | with @code{delq}, even though @code{remq} is not built-in to | ||
| 4053 | Emacs 19. | ||
| 4054 | @end defun | ||
| 4055 | |||
| 4056 | @defun remove-duplicates seq @t{&key :test :test-not :key :start :end :from-end} | 4005 | @defun remove-duplicates seq @t{&key :test :test-not :key :start :end :from-end} |
| 4057 | This function returns a copy of @var{seq} with duplicate elements | 4006 | This function returns a copy of @var{seq} with duplicate elements |
| 4058 | removed. Specifically, if two elements from the sequence match | 4007 | removed. Specifically, if two elements from the sequence match |
| @@ -4158,7 +4107,7 @@ if no matches were found. If @code{:from-end} is true, the | |||
| 4158 | function finds the @emph{rightmost} matching subsequence. | 4107 | function finds the @emph{rightmost} matching subsequence. |
| 4159 | @end defun | 4108 | @end defun |
| 4160 | 4109 | ||
| 4161 | @node Sorting Sequences, , Searching Sequences, Sequences | 4110 | @node Sorting Sequences, , Searching Sequences, Sequences |
| 4162 | @section Sorting Sequences | 4111 | @section Sorting Sequences |
| 4163 | 4112 | ||
| 4164 | @defun sort* seq predicate @t{&key :key} | 4113 | @defun sort* seq predicate @t{&key :key} |
| @@ -4215,7 +4164,7 @@ a merged sequence which is (stably) sorted according to | |||
| 4215 | @var{predicate}. | 4164 | @var{predicate}. |
| 4216 | @end defun | 4165 | @end defun |
| 4217 | 4166 | ||
| 4218 | @node Lists, Hash Tables, Sequences, Top | 4167 | @node Lists, Structures, Sequences, Top |
| 4219 | @chapter Lists | 4168 | @chapter Lists |
| 4220 | 4169 | ||
| 4221 | @noindent | 4170 | @noindent |
| @@ -4414,7 +4363,7 @@ are compared by @code{eql} by default; you can use the @code{:test}, | |||
| 4414 | @xref{Sequences}. | 4363 | @xref{Sequences}. |
| 4415 | 4364 | ||
| 4416 | Note that this function's name is suffixed by @samp{*} to avoid | 4365 | Note that this function's name is suffixed by @samp{*} to avoid |
| 4417 | the incompatible @code{member} function defined in Emacs 19. | 4366 | the incompatible @code{member} function defined in Emacs. |
| 4418 | (That function uses @code{equal} for comparisons; it is equivalent | 4367 | (That function uses @code{equal} for comparisons; it is equivalent |
| 4419 | to @code{(member* @var{item} @var{list} :test 'equal)}.) | 4368 | to @code{(member* @var{item} @var{list} :test 'equal)}.) |
| 4420 | @end defun | 4369 | @end defun |
| @@ -4497,7 +4446,7 @@ of @var{list2}, i.e., whether every element of @var{list1} | |||
| 4497 | also appears in @var{list2}. | 4446 | also appears in @var{list2}. |
| 4498 | @end defun | 4447 | @end defun |
| 4499 | 4448 | ||
| 4500 | @node Association Lists, , Lists as Sets, Lists | 4449 | @node Association Lists, , Lists as Sets, Lists |
| 4501 | @section Association Lists | 4450 | @section Association Lists |
| 4502 | 4451 | ||
| 4503 | @noindent | 4452 | @noindent |
| @@ -4541,160 +4490,11 @@ This is equivalent to @code{(nconc (mapcar* 'cons @var{keys} @var{values}) | |||
| 4541 | @var{alist})}. | 4490 | @var{alist})}. |
| 4542 | @end defun | 4491 | @end defun |
| 4543 | 4492 | ||
| 4544 | @node Hash Tables, Structures, Lists, Top | ||
| 4545 | @chapter Hash Tables | ||
| 4546 | |||
| 4547 | @noindent | ||
| 4548 | A @dfn{hash table} is a data structure that maps ``keys'' onto | ||
| 4549 | ``values.'' Keys and values can be arbitrary Lisp data objects. | ||
| 4550 | Hash tables have the property that the time to search for a given | ||
| 4551 | key is roughly constant; simpler data structures like association | ||
| 4552 | lists take time proportional to the number of entries in the list. | ||
| 4553 | |||
| 4554 | @defun make-hash-table @t{&key :test :size} | ||
| 4555 | This function creates and returns a hash-table object whose | ||
| 4556 | function for comparing elements is @code{:test} (@code{eql} | ||
| 4557 | by default), and which is allocated to fit about @code{:size} | ||
| 4558 | elements. The @code{:size} argument is purely advisory; the | ||
| 4559 | table will stretch automatically if you store more elements in | ||
| 4560 | it. If @code{:size} is omitted, a reasonable default is used. | ||
| 4561 | |||
| 4562 | Common Lisp allows only @code{eq}, @code{eql}, @code{equal}, | ||
| 4563 | and @code{equalp} as legal values for the @code{:test} argument. | ||
| 4564 | In this package, any reasonable predicate function will work, | ||
| 4565 | though if you use something else you should check the details of | ||
| 4566 | the hashing function described below to make sure it is suitable | ||
| 4567 | for your predicate. | ||
| 4568 | |||
| 4569 | Some versions of Emacs (like Lucid Emacs 19) include a built-in | ||
| 4570 | hash table type; in these versions, @code{make-hash-table} with | ||
| 4571 | a test of @code{eq} will use these built-in hash tables. In all | ||
| 4572 | other cases, it will return a hash-table object which takes the | ||
| 4573 | form of a list with an identifying ``tag'' symbol at the front. | ||
| 4574 | All of the hash table functions in this package can operate on | ||
| 4575 | both types of hash table; normally you will never know which | ||
| 4576 | type is being used. | ||
| 4577 | |||
| 4578 | This function accepts the additional Common Lisp keywords | ||
| 4579 | @code{:rehash-size} and @code{:rehash-threshold}, but it ignores | ||
| 4580 | their values. | ||
| 4581 | @end defun | ||
| 4582 | |||
| 4583 | @defun gethash key table &optional default | ||
| 4584 | This function looks up @var{key} in @var{table}. If @var{key} | ||
| 4585 | exists in the table, in the sense that it matches any of the existing | ||
| 4586 | keys according to the table's test function, then the associated value | ||
| 4587 | is returned. Otherwise, @var{default} (or @code{nil}) is returned. | ||
| 4588 | |||
| 4589 | To store new data in the hash table, use @code{setf} on a call to | ||
| 4590 | @code{gethash}. If @var{key} already exists in the table, the | ||
| 4591 | corresponding value is changed to the stored value. If @var{key} | ||
| 4592 | does not already exist, a new entry is added to the table and the | ||
| 4593 | table is reallocated to a larger size if necessary. The @var{default} | ||
| 4594 | argument is allowed but ignored in this case. The situation is | ||
| 4595 | exactly analogous to that of @code{get*}; @pxref{Property Lists}. | ||
| 4596 | @end defun | ||
| 4597 | |||
| 4598 | @defun remhash key table | ||
| 4599 | This function removes the entry for @var{key} from @var{table}. | ||
| 4600 | If an entry was removed, it returns @code{t}. If @var{key} does | ||
| 4601 | not appear in the table, it does nothing and returns @code{nil}. | ||
| 4602 | @end defun | ||
| 4603 | |||
| 4604 | @defun clrhash table | ||
| 4605 | This function removes all the entries from @var{table}, leaving | ||
| 4606 | an empty hash table. | ||
| 4607 | @end defun | ||
| 4608 | |||
| 4609 | @defun maphash function table | ||
| 4610 | This function calls @var{function} for each entry in @var{table}. | ||
| 4611 | It passes two arguments to @var{function}, the key and the value | ||
| 4612 | of the given entry. The return value of @var{function} is ignored; | ||
| 4613 | @var{maphash} itself returns @code{nil}. @xref{Loop Facility}, for | ||
| 4614 | an alternate way of iterating over hash tables. | ||
| 4615 | @end defun | ||
| 4616 | |||
| 4617 | @defun hash-table-count table | ||
| 4618 | This function returns the number of entries in @var{table}. | ||
| 4619 | @strong{Warning:} The current implementation of Lucid Emacs 19 | ||
| 4620 | hash-tables does not decrement the stored @code{count} when | ||
| 4621 | @code{remhash} removes an entry. Therefore, the return value of | ||
| 4622 | this function is not dependable if you have used @code{remhash} | ||
| 4623 | on the table and the table's test is @code{eq}. A slower, but | ||
| 4624 | reliable, way to count the entries is @code{(loop for x being the | ||
| 4625 | hash-keys of @var{table} count t)}. | ||
| 4626 | @end defun | ||
| 4627 | |||
| 4628 | @defun hash-table-p object | ||
| 4629 | This function returns @code{t} if @var{object} is a hash table, | ||
| 4630 | @code{nil} otherwise. It recognizes both types of hash tables | ||
| 4631 | (both Lucid Emacs built-in tables and tables implemented with | ||
| 4632 | special lists.) | ||
| 4633 | @end defun | ||
| 4634 | |||
| 4635 | Sometimes when dealing with hash tables it is useful to know the | ||
| 4636 | exact ``hash function'' that is used. This package implements | ||
| 4637 | hash tables using Emacs Lisp ``obarrays,'' which are the same | ||
| 4638 | data structure that Emacs Lisp uses to keep track of symbols. | ||
| 4639 | Each hash table includes an embedded obarray. Key values given | ||
| 4640 | to @code{gethash} are converted by various means into strings, | ||
| 4641 | which are then looked up in the obarray using @code{intern} and | ||
| 4642 | @code{intern-soft}. The symbol, or ``bucket,'' corresponding to | ||
| 4643 | a given key string includes as its @code{symbol-value} an association | ||
| 4644 | list of all key-value pairs which hash to that string. Depending | ||
| 4645 | on the test function, it is possible for many entries to hash to | ||
| 4646 | the same bucket. For example, if the test is @code{eql}, then the | ||
| 4647 | symbol @code{foo} and two separately built strings @code{"foo"} will | ||
| 4648 | create three entries in the same bucket. Search time is linear | ||
| 4649 | within buckets, so hash tables will be most effective if you arrange | ||
| 4650 | not to store too many things that hash the same. | ||
| 4651 | |||
| 4652 | The following algorithm is used to convert Lisp objects to hash | ||
| 4653 | strings: | ||
| 4654 | |||
| 4655 | @itemize @bullet | ||
| 4656 | @item | ||
| 4657 | Strings are used directly as hash strings. (However, if the test | ||
| 4658 | function is @code{equalp}, strings are @code{downcase}d first.) | ||
| 4659 | |||
| 4660 | @item | ||
| 4661 | Symbols are hashed according to their @code{symbol-name}. | ||
| 4662 | |||
| 4663 | @item | ||
| 4664 | Integers are hashed into one of 16 buckets depending on their value | ||
| 4665 | modulo 16. Floating-point numbers are truncated to integers and | ||
| 4666 | hashed modulo 16. | ||
| 4667 | |||
| 4668 | @item | ||
| 4669 | Cons cells are hashed according to their @code{car}s; nonempty vectors | ||
| 4670 | are hashed according to their first element. | ||
| 4671 | |||
| 4672 | @item | ||
| 4673 | All other types of objects hash into a single bucket named @code{"*"}. | ||
| 4674 | @end itemize | ||
| 4675 | |||
| 4676 | @noindent | ||
| 4677 | Thus, for example, searching among many buffer objects in a hash table | ||
| 4678 | will devolve to a (still fairly fast) linear-time search through a | ||
| 4679 | single bucket, whereas searching for different symbols will be very | ||
| 4680 | fast since each symbol will, in general, hash into its own bucket. | ||
| 4681 | |||
| 4682 | The size of the obarray in a hash table is automatically adjusted | ||
| 4683 | as the number of elements increases. | ||
| 4684 | |||
| 4685 | As a special case, @code{make-hash-table} with a @code{:size} argument | ||
| 4686 | of 0 or 1 will create a hash-table object that uses a single association | ||
| 4687 | list rather than an obarray of many lists. For very small tables this | ||
| 4688 | structure will be more efficient since lookup does not require | ||
| 4689 | converting the key to a string or looking it up in an obarray. | ||
| 4690 | However, such tables are guaranteed to take time proportional to | ||
| 4691 | their size to do a search. | ||
| 4692 | |||
| 4693 | @iftex | 4493 | @iftex |
| 4694 | @chapno=18 | 4494 | @chapno=18 |
| 4695 | @end iftex | 4495 | @end iftex |
| 4696 | 4496 | ||
| 4697 | @node Structures, Assertions, Hash Tables, Top | 4497 | @node Structures, Assertions, Lists, Top |
| 4698 | @chapter Structures | 4498 | @chapter Structures |
| 4699 | 4499 | ||
| 4700 | @noindent | 4500 | @noindent |
| @@ -5241,22 +5041,7 @@ do check their keyword arguments for validity. | |||
| 5241 | @appendixsec Optimizing Compiler | 5041 | @appendixsec Optimizing Compiler |
| 5242 | 5042 | ||
| 5243 | @noindent | 5043 | @noindent |
| 5244 | The byte-compiler that comes with Emacs 18 normally fails to expand | 5044 | Use of the optimizing Emacs compiler is highly recommended; many of the Common |
| 5245 | macros that appear in top-level positions in the file (i.e., outside | ||
| 5246 | of @code{defun}s or other enclosing forms). This would have | ||
| 5247 | disastrous consequences to programs that used such top-level macros | ||
| 5248 | as @code{defun*}, @code{eval-when}, and @code{defstruct}. To | ||
| 5249 | work around this problem, the @dfn{CL} package patches the Emacs | ||
| 5250 | 18 compiler to expand top-level macros. This patch will apply to | ||
| 5251 | your own macros, too, if they are used in a top-level context. | ||
| 5252 | The patch will not harm versions of the Emacs 18 compiler which | ||
| 5253 | have already had a similar patch applied, nor will it affect the | ||
| 5254 | optimizing Emacs 19 byte-compiler written by Jamie Zawinski and | ||
| 5255 | Hallvard Furuseth. The patch is applied to the byte compiler's | ||
| 5256 | code in Emacs' memory, @emph{not} to the @file{bytecomp.elc} file | ||
| 5257 | stored on disk. | ||
| 5258 | |||
| 5259 | Use of the Emacs 19 compiler is highly recommended; many of the Common | ||
| 5260 | Lisp macros emit | 5045 | Lisp macros emit |
| 5261 | code which can be improved by optimization. In particular, | 5046 | code which can be improved by optimization. In particular, |
| 5262 | @code{block}s (whether explicit or implicit in constructs like | 5047 | @code{block}s (whether explicit or implicit in constructs like |
| @@ -5356,7 +5141,7 @@ The @code{member}, @code{floor}, @code{ceiling}, @code{truncate}, | |||
| 5356 | by @samp{*} in this package to avoid collision with existing | 5141 | by @samp{*} in this package to avoid collision with existing |
| 5357 | functions in Emacs. The older package simply | 5142 | functions in Emacs. The older package simply |
| 5358 | redefined these functions, overwriting the built-in meanings and | 5143 | redefined these functions, overwriting the built-in meanings and |
| 5359 | causing serious portability problems with Emacs 19. (Some more | 5144 | causing serious portability problems. (Some more |
| 5360 | recent versions of the Quiroz package changed the names to | 5145 | recent versions of the Quiroz package changed the names to |
| 5361 | @code{cl-member}, etc.; this package defines the latter names as | 5146 | @code{cl-member}, etc.; this package defines the latter names as |
| 5362 | aliases for @code{member*}, etc.) | 5147 | aliases for @code{member*}, etc.) |
| @@ -5432,7 +5217,7 @@ package. The newer @code{floor*} and friends return their two | |||
| 5432 | results in a list rather than as multiple values. Note that | 5217 | results in a list rather than as multiple values. Note that |
| 5433 | older versions of the old package used the unadorned names | 5218 | older versions of the old package used the unadorned names |
| 5434 | @code{floor}, @code{ceiling}, etc.; @code{cl-compat} cannot use | 5219 | @code{floor}, @code{ceiling}, etc.; @code{cl-compat} cannot use |
| 5435 | these names because they conflict with Emacs 19 built-ins. | 5220 | these names because they conflict with Emacs built-ins. |
| 5436 | 5221 | ||
| 5437 | @node Porting Common Lisp, Function Index, Old CL Compatibility, Top | 5222 | @node Porting Common Lisp, Function Index, Old CL Compatibility, Top |
| 5438 | @appendix Porting Common Lisp | 5223 | @appendix Porting Common Lisp |
| @@ -5575,7 +5360,7 @@ Emacs Lisp's @code{format} would rarely be useful. | |||
| 5575 | @item | 5360 | @item |
| 5576 | Vector constants use square brackets in Emacs Lisp, but | 5361 | Vector constants use square brackets in Emacs Lisp, but |
| 5577 | @code{#(a b c)} notation in Common Lisp. To further complicate | 5362 | @code{#(a b c)} notation in Common Lisp. To further complicate |
| 5578 | matters, Emacs 19 introduces its own @code{#(} notation for | 5363 | matters, Emacs has its own @code{#(} notation for |
| 5579 | something entirely different---strings with properties. | 5364 | something entirely different---strings with properties. |
| 5580 | 5365 | ||
| 5581 | @item | 5366 | @item |
| @@ -5651,7 +5436,7 @@ recursion. | |||
| 5651 | 5436 | ||
| 5652 | @printindex fn | 5437 | @printindex fn |
| 5653 | 5438 | ||
| 5654 | @node Variable Index, , Function Index, Top | 5439 | @node Variable Index, , Function Index, Top |
| 5655 | @unnumbered Variable Index | 5440 | @unnumbered Variable Index |
| 5656 | 5441 | ||
| 5657 | @printindex vr | 5442 | @printindex vr |