diff options
| author | Glenn Morris | 2012-11-02 21:19:40 -0400 |
|---|---|---|
| committer | Glenn Morris | 2012-11-02 21:19:40 -0400 |
| commit | c65b407b40fcfd0aa99ba159c5b67d16133380a2 (patch) | |
| tree | a31bf3703000d1751996f91ce9aeafe1eb98f1bf | |
| parent | 7fbf8f7bd9a23a7cd946b60b4a8ec45124433b17 (diff) | |
| download | emacs-c65b407b40fcfd0aa99ba159c5b67d16133380a2.tar.gz emacs-c65b407b40fcfd0aa99ba159c5b67d16133380a2.zip | |
* doc/misc/cl.texi: Further general copyedits.
Eg, no longer distinguish between "the optimizing compiler" and "the
non-optimizing compiler" like they were different entities.
| -rw-r--r-- | doc/misc/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/misc/cl.texi | 155 |
2 files changed, 83 insertions, 76 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 36f8d01bbd9..39d7ee8d1fc 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-11-03 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * cl.texi: Further general copyedits. | ||
| 4 | |||
| 1 | 2012-11-02 Glenn Morris <rgm@gnu.org> | 5 | 2012-11-02 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * cl.texi (Naming Conventions, Type Predicates, Macros) | 7 | * cl.texi (Naming Conventions, Type Predicates, Macros) |
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 9de8ee37165..66d25144dd6 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi | |||
| @@ -836,7 +836,7 @@ constructs. | |||
| 836 | * Conditionals:: @code{cl-case}, @code{cl-typecase}. | 836 | * Conditionals:: @code{cl-case}, @code{cl-typecase}. |
| 837 | * Blocks and Exits:: @code{cl-block}, @code{cl-return}, @code{cl-return-from}. | 837 | * Blocks and Exits:: @code{cl-block}, @code{cl-return}, @code{cl-return-from}. |
| 838 | * Iteration:: @code{cl-do}, @code{cl-dotimes}, @code{cl-dolist}, @code{cl-do-symbols}. | 838 | * Iteration:: @code{cl-do}, @code{cl-dotimes}, @code{cl-dolist}, @code{cl-do-symbols}. |
| 839 | * Loop Facility:: The Common Lisp @code{cl-loop} macro. | 839 | * Loop Facility:: The Common Lisp @code{loop} macro. |
| 840 | * Multiple Values:: @code{cl-values}, @code{cl-multiple-value-bind}, etc. | 840 | * Multiple Values:: @code{cl-values}, @code{cl-multiple-value-bind}, etc. |
| 841 | @end menu | 841 | @end menu |
| 842 | 842 | ||
| @@ -1524,7 +1524,7 @@ Common Lisp @dfn{blocks} provide a non-local exit mechanism very | |||
| 1524 | similar to @code{catch} and @code{throw}, with lexical scoping. | 1524 | similar to @code{catch} and @code{throw}, with lexical scoping. |
| 1525 | This package actually implements @code{cl-block} | 1525 | This package actually implements @code{cl-block} |
| 1526 | in terms of @code{catch}; however, the lexical scoping allows the | 1526 | in terms of @code{catch}; however, the lexical scoping allows the |
| 1527 | optimizing byte-compiler to omit the costly @code{catch} step if the | 1527 | byte-compiler to omit the costly @code{catch} step if the |
| 1528 | body of the block does not actually @code{cl-return-from} the block. | 1528 | body of the block does not actually @code{cl-return-from} the block. |
| 1529 | 1529 | ||
| 1530 | @defmac cl-block name forms@dots{} | 1530 | @defmac cl-block name forms@dots{} |
| @@ -1561,7 +1561,7 @@ just as in Common Lisp. | |||
| 1561 | Because they are implemented in terms of Emacs Lisp's @code{catch} | 1561 | Because they are implemented in terms of Emacs Lisp's @code{catch} |
| 1562 | and @code{throw}, blocks have the same overhead as actual | 1562 | and @code{throw}, blocks have the same overhead as actual |
| 1563 | @code{catch} constructs (roughly two function calls). However, | 1563 | @code{catch} constructs (roughly two function calls). However, |
| 1564 | the optimizing byte compiler will optimize away the @code{catch} | 1564 | the byte compiler will optimize away the @code{catch} |
| 1565 | if the block does | 1565 | if the block does |
| 1566 | not in fact contain any @code{cl-return} or @code{cl-return-from} calls | 1566 | not in fact contain any @code{cl-return} or @code{cl-return-from} calls |
| 1567 | that jump to it. This means that @code{cl-do} loops and @code{cl-defun} | 1567 | that jump to it. This means that @code{cl-do} loops and @code{cl-defun} |
| @@ -1726,18 +1726,18 @@ iterating over vectors or lists. | |||
| 1726 | @section Loop Facility | 1726 | @section Loop Facility |
| 1727 | 1727 | ||
| 1728 | @noindent | 1728 | @noindent |
| 1729 | A common complaint with Lisp's traditional looping constructs is | 1729 | A common complaint with Lisp's traditional looping constructs was |
| 1730 | that they are either too simple and limited, such as Common Lisp's | 1730 | that they were either too simple and limited, such as @code{dotimes} |
| 1731 | @code{dotimes} or Emacs Lisp's @code{while}, or too unreadable and | 1731 | or @code{while}, or too unreadable and obscure, like Common Lisp's |
| 1732 | obscure, like Common Lisp's @code{do} loop. | 1732 | @code{do} loop. |
| 1733 | 1733 | ||
| 1734 | To remedy this, recent versions of Common Lisp have added a new | 1734 | To remedy this, Common Lisp added a construct called the ``Loop |
| 1735 | construct called the ``Loop Facility'' or ``@code{loop} macro'', | 1735 | Facility'' or ``@code{loop} macro'', with an easy-to-use but very |
| 1736 | with an easy-to-use but very powerful and expressive syntax. | 1736 | powerful and expressive syntax. |
| 1737 | 1737 | ||
| 1738 | @menu | 1738 | @menu |
| 1739 | * Loop Basics:: @code{cl-loop} macro, basic clause structure. | 1739 | * Loop Basics:: The @code{cl-loop} macro, basic clause structure. |
| 1740 | * Loop Examples:: Working examples of @code{cl-loop} macro. | 1740 | * Loop Examples:: Working examples of the @code{cl-loop} macro. |
| 1741 | * For Clauses:: Clauses introduced by @code{for} or @code{as}. | 1741 | * For Clauses:: Clauses introduced by @code{for} or @code{as}. |
| 1742 | * Iteration Clauses:: @code{repeat}, @code{while}, @code{thereis}, etc. | 1742 | * Iteration Clauses:: @code{repeat}, @code{while}, @code{thereis}, etc. |
| 1743 | * Accumulation Clauses:: @code{collect}, @code{sum}, @code{maximize}, etc. | 1743 | * Accumulation Clauses:: @code{collect}, @code{sum}, @code{maximize}, etc. |
| @@ -1770,9 +1770,9 @@ Common Lisp specifies a certain general order of clauses in a | |||
| 1770 | loop: | 1770 | loop: |
| 1771 | 1771 | ||
| 1772 | @example | 1772 | @example |
| 1773 | (cl-loop @var{name-clause} | 1773 | (loop @var{name-clause} |
| 1774 | @var{var-clauses}@dots{} | 1774 | @var{var-clauses}@dots{} |
| 1775 | @var{action-clauses}@dots{}) | 1775 | @var{action-clauses}@dots{}) |
| 1776 | @end example | 1776 | @end example |
| 1777 | 1777 | ||
| 1778 | The @var{name-clause} optionally gives a name to the implicit | 1778 | The @var{name-clause} optionally gives a name to the implicit |
| @@ -1798,10 +1798,10 @@ also use regular Lisp @code{cl-return} or @code{cl-return-from} to | |||
| 1798 | break out of the loop.) | 1798 | break out of the loop.) |
| 1799 | @end defmac | 1799 | @end defmac |
| 1800 | 1800 | ||
| 1801 | The following sections give some examples of the Loop Macro in | 1801 | The following sections give some examples of the loop macro in |
| 1802 | action, and describe the particular loop clauses in great detail. | 1802 | action, and describe the particular loop clauses in great detail. |
| 1803 | Consult the second edition of Steele for additional discussion | 1803 | Consult the second edition of Steele for additional discussion |
| 1804 | and examples of the @code{loop} macro. | 1804 | and examples. |
| 1805 | 1805 | ||
| 1806 | @node Loop Examples | 1806 | @node Loop Examples |
| 1807 | @subsection Loop Examples | 1807 | @subsection Loop Examples |
| @@ -2165,8 +2165,9 @@ that was just set by the previous clause; in the second loop, | |||
| 2165 | based on the value of @code{x} left over from the previous time | 2165 | based on the value of @code{x} left over from the previous time |
| 2166 | through the loop. | 2166 | through the loop. |
| 2167 | 2167 | ||
| 2168 | Another feature of the @code{cl-loop} macro is @dfn{destructuring}, | 2168 | Another feature of the @code{cl-loop} macro is @emph{destructuring}, |
| 2169 | similar in concept to the destructuring provided by @code{defmacro}. | 2169 | similar in concept to the destructuring provided by @code{defmacro} |
| 2170 | (@pxref{Argument Lists}). | ||
| 2170 | The @var{var} part of any @code{for} clause can be given as a list | 2171 | The @var{var} part of any @code{for} clause can be given as a list |
| 2171 | of variables instead of a single variable. The values produced | 2172 | of variables instead of a single variable. The values produced |
| 2172 | during loop execution must be lists; the values in the lists are | 2173 | during loop execution must be lists; the values in the lists are |
| @@ -2378,7 +2379,7 @@ by the name @code{it} in the ``then'' part. For example: | |||
| 2378 | (setq funny-numbers '(6 13 -1)) | 2379 | (setq funny-numbers '(6 13 -1)) |
| 2379 | @result{} (6 13 -1) | 2380 | @result{} (6 13 -1) |
| 2380 | (cl-loop for x below 10 | 2381 | (cl-loop for x below 10 |
| 2381 | if (oddp x) | 2382 | if (cl-oddp x) |
| 2382 | collect x into odds | 2383 | collect x into odds |
| 2383 | and if (memq x funny-numbers) return (cdr it) end | 2384 | and if (memq x funny-numbers) return (cdr it) end |
| 2384 | else | 2385 | else |
| @@ -2444,15 +2445,14 @@ loop. Many of the examples in this section illustrate the use of | |||
| 2444 | 2445 | ||
| 2445 | @item return @var{form} | 2446 | @item return @var{form} |
| 2446 | This clause causes the loop to return immediately. The following | 2447 | This clause causes the loop to return immediately. The following |
| 2447 | Lisp form is evaluated to give the return value of the @code{loop} | 2448 | Lisp form is evaluated to give the return value of the loop |
| 2448 | form. The @code{finally} clauses, if any, are not executed. | 2449 | form. The @code{finally} clauses, if any, are not executed. |
| 2449 | Of course, @code{return} is generally used inside an @code{if} or | 2450 | Of course, @code{return} is generally used inside an @code{if} or |
| 2450 | @code{unless}, as its use in a top-level loop clause would mean | 2451 | @code{unless}, as its use in a top-level loop clause would mean |
| 2451 | the loop would never get to ``loop'' more than once. | 2452 | the loop would never get to ``loop'' more than once. |
| 2452 | 2453 | ||
| 2453 | The clause @samp{return @var{form}} is equivalent to | 2454 | The clause @samp{return @var{form}} is equivalent to |
| 2454 | @c FIXME cl-do, cl-return? | 2455 | @samp{do (cl-return @var{form})} (or @code{cl-return-from} if the loop |
| 2455 | @samp{do (return @var{form})} (or @code{return-from} if the loop | ||
| 2456 | was named). The @code{return} clause is implemented a bit more | 2456 | was named). The @code{return} clause is implemented a bit more |
| 2457 | efficiently, though. | 2457 | efficiently, though. |
| 2458 | @end table | 2458 | @end table |
| @@ -2466,7 +2466,7 @@ clause, respectively. Consult the source code in file | |||
| 2466 | 2466 | ||
| 2467 | This package's @code{cl-loop} macro is compatible with that of Common | 2467 | This package's @code{cl-loop} macro is compatible with that of Common |
| 2468 | Lisp, except that a few features are not implemented: @code{loop-finish} | 2468 | Lisp, except that a few features are not implemented: @code{loop-finish} |
| 2469 | and data-type specifiers. Naturally, the @code{for} clauses which | 2469 | and data-type specifiers. Naturally, the @code{for} clauses that |
| 2470 | iterate over keymaps, overlays, intervals, frames, windows, and | 2470 | iterate over keymaps, overlays, intervals, frames, windows, and |
| 2471 | buffers are Emacs-specific extensions. | 2471 | buffers are Emacs-specific extensions. |
| 2472 | 2472 | ||
| @@ -2519,17 +2519,17 @@ Destructuring is made available to the user by way of the | |||
| 2519 | following macro: | 2519 | following macro: |
| 2520 | 2520 | ||
| 2521 | @defmac cl-destructuring-bind arglist expr forms@dots{} | 2521 | @defmac cl-destructuring-bind arglist expr forms@dots{} |
| 2522 | This macro expands to code which executes @var{forms}, with | 2522 | This macro expands to code that executes @var{forms}, with |
| 2523 | the variables in @var{arglist} bound to the list of values | 2523 | the variables in @var{arglist} bound to the list of values |
| 2524 | returned by @var{expr}. The @var{arglist} can include all | 2524 | returned by @var{expr}. The @var{arglist} can include all |
| 2525 | the features allowed for @code{defmacro} argument lists, | 2525 | the features allowed for @code{cl-defmacro} argument lists, |
| 2526 | including destructuring. (The @code{&environment} keyword | 2526 | including destructuring. (The @code{&environment} keyword |
| 2527 | is not allowed.) The macro expansion will signal an error | 2527 | is not allowed.) The macro expansion will signal an error |
| 2528 | if @var{expr} returns a list of the wrong number of arguments | 2528 | if @var{expr} returns a list of the wrong number of arguments |
| 2529 | or with incorrect keyword arguments. | 2529 | or with incorrect keyword arguments. |
| 2530 | @end defmac | 2530 | @end defmac |
| 2531 | 2531 | ||
| 2532 | This package also includes the Common Lisp @code{cl-define-compiler-macro} | 2532 | This package also includes the Common Lisp @code{define-compiler-macro} |
| 2533 | facility, which allows you to define compile-time expansions and | 2533 | facility, which allows you to define compile-time expansions and |
| 2534 | optimizations for your functions. | 2534 | optimizations for your functions. |
| 2535 | 2535 | ||
| @@ -2592,16 +2592,19 @@ mechanism that allows you to give the compiler special hints | |||
| 2592 | about the types of data that will be stored in particular variables, | 2592 | about the types of data that will be stored in particular variables, |
| 2593 | and about the ways those variables and functions will be used. This | 2593 | and about the ways those variables and functions will be used. This |
| 2594 | package defines versions of all the Common Lisp declaration forms: | 2594 | package defines versions of all the Common Lisp declaration forms: |
| 2595 | @code{cl-declare}, @code{cl-locally}, @code{cl-proclaim}, @code{cl-declaim}, | 2595 | @code{declare}, @code{locally}, @code{proclaim}, @code{declaim}, |
| 2596 | and @code{cl-the}. | 2596 | and @code{the}. |
| 2597 | 2597 | ||
| 2598 | Most of the Common Lisp declarations are not currently useful in | 2598 | Most of the Common Lisp declarations are not currently useful in Emacs |
| 2599 | Emacs Lisp, as the byte-code system provides little opportunity | 2599 | Lisp. For example, the byte-code system provides little |
| 2600 | to benefit from type information, and @code{special} declarations | 2600 | opportunity to benefit from type information. |
| 2601 | are redundant in a fully dynamically-scoped Lisp. A few | 2601 | @ignore |
| 2602 | declarations are meaningful when the optimizing byte | 2602 | and @code{special} declarations are redundant in a fully |
| 2603 | compiler is being used, however. Under the earlier non-optimizing | 2603 | dynamically-scoped Lisp. |
| 2604 | compiler, these declarations will effectively be ignored. | 2604 | @end ignore |
| 2605 | A few declarations are meaningful when byte compiler optimizations | ||
| 2606 | are enabled, as they are by the default. Otherwise these | ||
| 2607 | declarations will effectively be ignored. | ||
| 2605 | 2608 | ||
| 2606 | @defun cl-proclaim decl-spec | 2609 | @defun cl-proclaim decl-spec |
| 2607 | This function records a ``global'' declaration specified by | 2610 | This function records a ``global'' declaration specified by |
| @@ -2612,7 +2615,7 @@ is evaluated and thus should normally be quoted. | |||
| 2612 | @defmac cl-declaim decl-specs@dots{} | 2615 | @defmac cl-declaim decl-specs@dots{} |
| 2613 | This macro is like @code{cl-proclaim}, except that it takes any number | 2616 | This macro is like @code{cl-proclaim}, except that it takes any number |
| 2614 | of @var{decl-spec} arguments, and the arguments are unevaluated and | 2617 | of @var{decl-spec} arguments, and the arguments are unevaluated and |
| 2615 | unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when | 2618 | unquoted. The @code{cl-declaim} macro also puts @code{(cl-eval-when |
| 2616 | (compile load eval) @dots{})} around the declarations so that they will | 2619 | (compile load eval) @dots{})} around the declarations so that they will |
| 2617 | be registered at compile-time as well as at run-time. (This is vital, | 2620 | be registered at compile-time as well as at run-time. (This is vital, |
| 2618 | since normally the declarations are meant to influence the way the | 2621 | since normally the declarations are meant to influence the way the |
| @@ -2635,9 +2638,9 @@ In this package, @code{cl-locally} is no different from @code{progn}. | |||
| 2635 | 2638 | ||
| 2636 | @defmac cl-the type form | 2639 | @defmac cl-the type form |
| 2637 | Type information provided by @code{cl-the} is ignored in this package; | 2640 | Type information provided by @code{cl-the} is ignored in this package; |
| 2638 | in other words, @code{(cl-the @var{type} @var{form})} is equivalent | 2641 | in other words, @code{(cl-the @var{type} @var{form})} is equivalent to |
| 2639 | to @var{form}. Future versions of the optimizing byte-compiler may | 2642 | @var{form}. Future byte-compiler optimizations may make use of this |
| 2640 | make use of this information. | 2643 | information. |
| 2641 | 2644 | ||
| 2642 | For example, @code{mapcar} can map over both lists and arrays. It is | 2645 | For example, @code{mapcar} can map over both lists and arrays. It is |
| 2643 | hard for the compiler to expand @code{mapcar} into an in-line loop | 2646 | hard for the compiler to expand @code{mapcar} into an in-line loop |
| @@ -2658,35 +2661,31 @@ such as @code{type} and @code{ftype}, are silently ignored. | |||
| 2658 | 2661 | ||
| 2659 | @table @code | 2662 | @table @code |
| 2660 | @item special | 2663 | @item special |
| 2664 | @c FIXME ? | ||
| 2661 | Since all variables in Emacs Lisp are ``special'' (in the Common | 2665 | Since all variables in Emacs Lisp are ``special'' (in the Common |
| 2662 | Lisp sense), @code{special} declarations are only advisory. They | 2666 | Lisp sense), @code{special} declarations are only advisory. They |
| 2663 | simply tell the optimizing byte compiler that the specified | 2667 | simply tell the byte compiler that the specified |
| 2664 | variables are intentionally being referred to without being | 2668 | variables are intentionally being referred to without being |
| 2665 | bound in the body of the function. The compiler normally emits | 2669 | bound in the body of the function. The compiler normally emits |
| 2666 | warnings for such references, since they could be typographical | 2670 | warnings for such references, since they could be typographical |
| 2667 | errors for references to local variables. | 2671 | errors for references to local variables. |
| 2668 | 2672 | ||
| 2669 | The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is | 2673 | The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is |
| 2670 | equivalent to @code{(defvar @var{var1}) (defvar @var{var2})} in the | 2674 | equivalent to @code{(defvar @var{var1}) (defvar @var{var2})}. |
| 2671 | optimizing compiler, or to nothing at all in older compilers (which | ||
| 2672 | do not warn for non-local references). | ||
| 2673 | 2675 | ||
| 2674 | In top-level contexts, it is generally better to write | 2676 | In top-level contexts, it is generally better to write |
| 2675 | @code{(defvar @var{var})} than @code{(cl-declaim (special @var{var}))}, | 2677 | @code{(defvar @var{var})} than @code{(cl-declaim (special @var{var}))}, |
| 2676 | since @code{defvar} makes your intentions clearer. But the older | 2678 | since @code{defvar} makes your intentions clearer. |
| 2677 | byte compilers can not handle @code{defvar}s appearing inside of | ||
| 2678 | functions, while @code{(cl-declare (special @var{var}))} takes care | ||
| 2679 | to work correctly with all compilers. | ||
| 2680 | 2679 | ||
| 2681 | @item inline | 2680 | @item inline |
| 2682 | The @code{inline} @var{decl-spec} lists one or more functions | 2681 | The @code{inline} @var{decl-spec} lists one or more functions |
| 2683 | whose bodies should be expanded ``in-line'' into calling functions | 2682 | whose bodies should be expanded ``in-line'' into calling functions |
| 2684 | whenever the compiler is able to arrange for it. For example, | 2683 | whenever the compiler is able to arrange for it. For example, |
| 2685 | the Common Lisp function @code{cadr} is declared @code{inline} | 2684 | the function @code{cl-acons} is declared @code{inline} |
| 2686 | by this package so that the form @code{(cadr @var{x})} will | 2685 | by this package so that the form @code{(cl-acons @var{key} @var{value} |
| 2687 | expand directly into @code{(car (cdr @var{x}))} when it is called | 2686 | @var{alist})} will |
| 2688 | in user functions, for a savings of one (relatively expensive) | 2687 | expand directly into @code{(cons (cons @var{key} @var{value}) @var{alist})} |
| 2689 | function call. | 2688 | when it is called in user functions, so as to save function calls. |
| 2690 | 2689 | ||
| 2691 | The following declarations are all equivalent. Note that the | 2690 | The following declarations are all equivalent. Note that the |
| 2692 | @code{defsubst} form is a convenient way to define a function | 2691 | @code{defsubst} form is a convenient way to define a function |
| @@ -2705,7 +2704,7 @@ request that a function you have defined should be inlined, | |||
| 2705 | but it is impolite to use it to request inlining of an external | 2704 | but it is impolite to use it to request inlining of an external |
| 2706 | function. | 2705 | function. |
| 2707 | 2706 | ||
| 2708 | In Common Lisp, it is possible to use @code{(cl-declare (inline @dots{}))} | 2707 | In Common Lisp, it is possible to use @code{(declare (inline @dots{}))} |
| 2709 | before a particular call to a function to cause just that call to | 2708 | before a particular call to a function to cause just that call to |
| 2710 | be inlined; the current byte compilers provide no way to implement | 2709 | be inlined; the current byte compilers provide no way to implement |
| 2711 | this, so @code{(cl-declare (inline @dots{}))} is currently ignored by | 2710 | this, so @code{(cl-declare (inline @dots{}))} is currently ignored by |
| @@ -2718,8 +2717,7 @@ declaration. | |||
| 2718 | 2717 | ||
| 2719 | @item optimize | 2718 | @item optimize |
| 2720 | This declaration controls how much optimization is performed by | 2719 | This declaration controls how much optimization is performed by |
| 2721 | the compiler. Naturally, it is ignored by the earlier non-optimizing | 2720 | the compiler. |
| 2722 | compilers. | ||
| 2723 | 2721 | ||
| 2724 | The word @code{optimize} is followed by any number of lists like | 2722 | The word @code{optimize} is followed by any number of lists like |
| 2725 | @code{(speed 3)} or @code{(safety 2)}. Common Lisp defines several | 2723 | @code{(speed 3)} or @code{(safety 2)}. Common Lisp defines several |
| @@ -2728,8 +2726,7 @@ and @code{safety}. The value of a quality should be an integer from | |||
| 2728 | 0 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''. | 2726 | 0 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''. |
| 2729 | The default level for both qualities is 1. | 2727 | The default level for both qualities is 1. |
| 2730 | 2728 | ||
| 2731 | In this package, with the optimizing compiler, the | 2729 | In this package, the @code{speed} quality is tied to the @code{byte-optimize} |
| 2732 | @code{speed} quality is tied to the @code{byte-optimize} | ||
| 2733 | flag, which is set to @code{nil} for @code{(speed 0)} and to | 2730 | flag, which is set to @code{nil} for @code{(speed 0)} and to |
| 2734 | @code{t} for higher settings; and the @code{safety} quality is | 2731 | @code{t} for higher settings; and the @code{safety} quality is |
| 2735 | tied to the @code{byte-compile-delete-errors} flag, which is | 2732 | tied to the @code{byte-compile-delete-errors} flag, which is |
| @@ -2748,22 +2745,22 @@ just because of an error in a fully-optimized Lisp program. | |||
| 2748 | 2745 | ||
| 2749 | The @code{optimize} declaration is normally used in a top-level | 2746 | The @code{optimize} declaration is normally used in a top-level |
| 2750 | @code{cl-proclaim} or @code{cl-declaim} in a file; Common Lisp allows | 2747 | @code{cl-proclaim} or @code{cl-declaim} in a file; Common Lisp allows |
| 2751 | it to be used with @code{cl-declare} to set the level of optimization | 2748 | it to be used with @code{declare} to set the level of optimization |
| 2752 | locally for a given form, but this will not work correctly with the | 2749 | locally for a given form, but this will not work correctly with the |
| 2753 | current version of the optimizing compiler. (The @code{cl-declare} | 2750 | current byte-compiler. (The @code{cl-declare} |
| 2754 | will set the new optimization level, but that level will not | 2751 | will set the new optimization level, but that level will not |
| 2755 | automatically be unset after the enclosing form is done.) | 2752 | automatically be unset after the enclosing form is done.) |
| 2756 | 2753 | ||
| 2757 | @item warn | 2754 | @item warn |
| 2758 | This declaration controls what sorts of warnings are generated | 2755 | This declaration controls what sorts of warnings are generated |
| 2759 | by the byte compiler. Again, only the optimizing compiler | 2756 | by the byte compiler. The word @code{warn} is followed by any |
| 2760 | generates warnings. The word @code{warn} is followed by any | ||
| 2761 | number of ``warning qualities'', similar in form to optimization | 2757 | number of ``warning qualities'', similar in form to optimization |
| 2762 | qualities. The currently supported warning types are | 2758 | qualities. The currently supported warning types are |
| 2763 | @code{redefine}, @code{callargs}, @code{unresolved}, and | 2759 | @code{redefine}, @code{callargs}, @code{unresolved}, and |
| 2764 | @code{free-vars}; in the current system, a value of 0 will | 2760 | @code{free-vars}; in the current system, a value of 0 will |
| 2765 | disable these warnings and any higher value will enable them. | 2761 | disable these warnings and any higher value will enable them. |
| 2766 | See the documentation for the optimizing byte compiler for details. | 2762 | See the documentation of the variable @code{byte-compile-warnings} |
| 2763 | for more details. | ||
| 2767 | @end table | 2764 | @end table |
| 2768 | 2765 | ||
| 2769 | @node Symbols | 2766 | @node Symbols |
| @@ -2878,6 +2875,8 @@ their names will not conflict with ``real'' variables in the user's | |||
| 2878 | code. | 2875 | code. |
| 2879 | @end defun | 2876 | @end defun |
| 2880 | 2877 | ||
| 2878 | @c FIXME texinfo renders this as as cl-gensym-counter in info. | ||
| 2879 | @c It looks fine in the index, and in the pdf version. | ||
| 2881 | @defvar cl--gensym-counter | 2880 | @defvar cl--gensym-counter |
| 2882 | This variable holds the counter used to generate @code{cl-gensym} names. | 2881 | This variable holds the counter used to generate @code{cl-gensym} names. |
| 2883 | It is incremented after each use by @code{cl-gensym}. In Common Lisp | 2882 | It is incremented after each use by @code{cl-gensym}. In Common Lisp |
| @@ -2908,13 +2907,13 @@ provided. | |||
| 2908 | 2907 | ||
| 2909 | @noindent | 2908 | @noindent |
| 2910 | This section defines a few simple Common Lisp operations on numbers | 2909 | This section defines a few simple Common Lisp operations on numbers |
| 2911 | which were left out of Emacs Lisp. | 2910 | that were left out of Emacs Lisp. |
| 2912 | 2911 | ||
| 2913 | @menu | 2912 | @menu |
| 2914 | * Predicates on Numbers:: @code{cl-plusp}, @code{cl-oddp}, etc. | 2913 | * Predicates on Numbers:: @code{cl-plusp}, @code{cl-oddp}, etc. |
| 2915 | * Numerical Functions:: @code{abs}, @code{cl-floor}, etc. | 2914 | * Numerical Functions:: @code{cl-floor}, @code{cl-ceiling}, etc. |
| 2916 | * Random Numbers:: @code{cl-random}, @code{cl-make-random-state}. | 2915 | * Random Numbers:: @code{cl-random}, @code{cl-make-random-state}. |
| 2917 | * Implementation Parameters:: @code{cl-most-positive-float}. | 2916 | * Implementation Parameters:: @code{cl-most-positive-float}, etc. |
| 2918 | @end menu | 2917 | @end menu |
| 2919 | 2918 | ||
| 2920 | @node Predicates on Numbers | 2919 | @node Predicates on Numbers |
| @@ -3041,6 +3040,7 @@ of @code{cl-truncate}. | |||
| 3041 | This package also provides an implementation of the Common Lisp | 3040 | This package also provides an implementation of the Common Lisp |
| 3042 | random number generator. It uses its own additive-congruential | 3041 | random number generator. It uses its own additive-congruential |
| 3043 | algorithm, which is much more likely to give statistically clean | 3042 | algorithm, which is much more likely to give statistically clean |
| 3043 | @c FIXME? Still true? | ||
| 3044 | random numbers than the simple generators supplied by many | 3044 | random numbers than the simple generators supplied by many |
| 3045 | operating systems. | 3045 | operating systems. |
| 3046 | 3046 | ||
| @@ -3048,13 +3048,15 @@ operating systems. | |||
| 3048 | This function returns a random nonnegative number less than | 3048 | This function returns a random nonnegative number less than |
| 3049 | @var{number}, and of the same type (either integer or floating-point). | 3049 | @var{number}, and of the same type (either integer or floating-point). |
| 3050 | The @var{state} argument should be a @code{random-state} object | 3050 | The @var{state} argument should be a @code{random-state} object |
| 3051 | which holds the state of the random number generator. The | 3051 | that holds the state of the random number generator. The |
| 3052 | function modifies this state object as a side effect. If | 3052 | function modifies this state object as a side effect. If |
| 3053 | @var{state} is omitted, it defaults to the variable | 3053 | @var{state} is omitted, it defaults to the variable |
| 3054 | @code{cl--random-state}, which contains a pre-initialized | 3054 | @code{cl--random-state}, which contains a pre-initialized |
| 3055 | @code{random-state} object. | 3055 | @code{random-state} object. |
| 3056 | @end defun | 3056 | @end defun |
| 3057 | 3057 | ||
| 3058 | @c FIXME texinfo renders this as cl-random-state in info. | ||
| 3059 | @c It looks fine in the index, and in the pdf version. | ||
| 3058 | @defvar cl--random-state | 3060 | @defvar cl--random-state |
| 3059 | This variable contains the system ``default'' @code{random-state} | 3061 | This variable contains the system ``default'' @code{random-state} |
| 3060 | object, used for calls to @code{cl-random} that do not specify an | 3062 | object, used for calls to @code{cl-random} that do not specify an |
| @@ -3099,10 +3101,10 @@ This predicate returns @code{t} if @var{object} is a | |||
| 3099 | @section Implementation Parameters | 3101 | @section Implementation Parameters |
| 3100 | 3102 | ||
| 3101 | @noindent | 3103 | @noindent |
| 3102 | This package defines several useful constants having to with numbers. | 3104 | This package defines several useful constants having to do with |
| 3105 | floating-point numbers. | ||
| 3103 | 3106 | ||
| 3104 | The following parameters have to do with floating-point numbers. | 3107 | It determines their values by exercising the computer's |
| 3105 | This package determines their values by exercising the computer's | ||
| 3106 | floating-point arithmetic in various ways. Because this operation | 3108 | floating-point arithmetic in various ways. Because this operation |
| 3107 | might be slow, the code for initializing them is kept in a separate | 3109 | might be slow, the code for initializing them is kept in a separate |
| 3108 | function that must be called before the parameters can be used. | 3110 | function that must be called before the parameters can be used. |
| @@ -3110,12 +3112,13 @@ function that must be called before the parameters can be used. | |||
| 3110 | @defun cl-float-limits | 3112 | @defun cl-float-limits |
| 3111 | This function makes sure that the Common Lisp floating-point parameters | 3113 | This function makes sure that the Common Lisp floating-point parameters |
| 3112 | like @code{cl-most-positive-float} have been initialized. Until it is | 3114 | like @code{cl-most-positive-float} have been initialized. Until it is |
| 3113 | called, these parameters will be @code{nil}. If this version of Emacs | 3115 | called, these parameters will be @code{nil}. |
| 3114 | does not support floats, the parameters will remain @code{nil}. If the | 3116 | @c If this version of Emacs does not support floats, the parameters will |
| 3115 | parameters have already been initialized, the function returns | 3117 | @c remain @code{nil}. |
| 3118 | If the parameters have already been initialized, the function returns | ||
| 3116 | immediately. | 3119 | immediately. |
| 3117 | 3120 | ||
| 3118 | The algorithm makes assumptions that will be valid for most modern | 3121 | The algorithm makes assumptions that will be valid for almost all |
| 3119 | machines, but will fail if the machine's arithmetic is extremely | 3122 | machines, but will fail if the machine's arithmetic is extremely |
| 3120 | unusual, e.g., decimal. | 3123 | unusual, e.g., decimal. |
| 3121 | @end defun | 3124 | @end defun |
| @@ -3135,7 +3138,7 @@ is approximately @code{1.79e+308}. | |||
| 3135 | @end defvar | 3138 | @end defvar |
| 3136 | 3139 | ||
| 3137 | @defvar cl-most-negative-float | 3140 | @defvar cl-most-negative-float |
| 3138 | This constant equals the most-negative value a Lisp float can hold. | 3141 | This constant equals the most negative value a Lisp float can hold. |
| 3139 | (It is assumed to be equal to @code{(- cl-most-positive-float)}.) | 3142 | (It is assumed to be equal to @code{(- cl-most-positive-float)}.) |
| 3140 | @end defvar | 3143 | @end defvar |
| 3141 | 3144 | ||
| @@ -4482,7 +4485,7 @@ Lisp macros emit | |||
| 4482 | code which can be improved by optimization. In particular, | 4485 | code which can be improved by optimization. In particular, |
| 4483 | @code{cl-block}s (whether explicit or implicit in constructs like | 4486 | @code{cl-block}s (whether explicit or implicit in constructs like |
| 4484 | @code{cl-defun} and @code{cl-loop}) carry a fair run-time penalty; the | 4487 | @code{cl-defun} and @code{cl-loop}) carry a fair run-time penalty; the |
| 4485 | optimizing compiler removes @code{cl-block}s which are not actually | 4488 | byte-compiler removes @code{cl-block}s which are not actually |
| 4486 | referenced by @code{cl-return} or @code{cl-return-from} inside the block. | 4489 | referenced by @code{cl-return} or @code{cl-return-from} inside the block. |
| 4487 | 4490 | ||
| 4488 | @node Common Lisp Compatibility | 4491 | @node Common Lisp Compatibility |