aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-11-02 21:19:40 -0400
committerGlenn Morris2012-11-02 21:19:40 -0400
commitc65b407b40fcfd0aa99ba159c5b67d16133380a2 (patch)
treea31bf3703000d1751996f91ce9aeafe1eb98f1bf
parent7fbf8f7bd9a23a7cd946b60b4a8ec45124433b17 (diff)
downloademacs-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/ChangeLog4
-rw-r--r--doc/misc/cl.texi155
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 @@
12012-11-03 Glenn Morris <rgm@gnu.org>
2
3 * cl.texi: Further general copyedits.
4
12012-11-02 Glenn Morris <rgm@gnu.org> 52012-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
1524similar to @code{catch} and @code{throw}, with lexical scoping. 1524similar to @code{catch} and @code{throw}, with lexical scoping.
1525This package actually implements @code{cl-block} 1525This package actually implements @code{cl-block}
1526in terms of @code{catch}; however, the lexical scoping allows the 1526in terms of @code{catch}; however, the lexical scoping allows the
1527optimizing byte-compiler to omit the costly @code{catch} step if the 1527byte-compiler to omit the costly @code{catch} step if the
1528body of the block does not actually @code{cl-return-from} the block. 1528body of the block does not actually @code{cl-return-from} the block.
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.
1561Because they are implemented in terms of Emacs Lisp's @code{catch} 1561Because they are implemented in terms of Emacs Lisp's @code{catch}
1562and @code{throw}, blocks have the same overhead as actual 1562and @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,
1564the optimizing byte compiler will optimize away the @code{catch} 1564the byte compiler will optimize away the @code{catch}
1565if the block does 1565if the block does
1566not in fact contain any @code{cl-return} or @code{cl-return-from} calls 1566not in fact contain any @code{cl-return} or @code{cl-return-from} calls
1567that jump to it. This means that @code{cl-do} loops and @code{cl-defun} 1567that jump to it. This means that @code{cl-do} loops and @code{cl-defun}
@@ -1726,18 +1726,18 @@ iterating over vectors or lists.
1726@section Loop Facility 1726@section Loop Facility
1727 1727
1728@noindent 1728@noindent
1729A common complaint with Lisp's traditional looping constructs is 1729A common complaint with Lisp's traditional looping constructs was
1730that they are either too simple and limited, such as Common Lisp's 1730that they were either too simple and limited, such as @code{dotimes}
1731@code{dotimes} or Emacs Lisp's @code{while}, or too unreadable and 1731or @code{while}, or too unreadable and obscure, like Common Lisp's
1732obscure, like Common Lisp's @code{do} loop. 1732@code{do} loop.
1733 1733
1734To remedy this, recent versions of Common Lisp have added a new 1734To remedy this, Common Lisp added a construct called the ``Loop
1735construct called the ``Loop Facility'' or ``@code{loop} macro'', 1735Facility'' or ``@code{loop} macro'', with an easy-to-use but very
1736with an easy-to-use but very powerful and expressive syntax. 1736powerful 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
1770loop: 1770loop:
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
1778The @var{name-clause} optionally gives a name to the implicit 1778The @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
1798break out of the loop.) 1798break out of the loop.)
1799@end defmac 1799@end defmac
1800 1800
1801The following sections give some examples of the Loop Macro in 1801The following sections give some examples of the loop macro in
1802action, and describe the particular loop clauses in great detail. 1802action, and describe the particular loop clauses in great detail.
1803Consult the second edition of Steele for additional discussion 1803Consult the second edition of Steele for additional discussion
1804and examples of the @code{loop} macro. 1804and 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,
2165based on the value of @code{x} left over from the previous time 2165based on the value of @code{x} left over from the previous time
2166through the loop. 2166through the loop.
2167 2167
2168Another feature of the @code{cl-loop} macro is @dfn{destructuring}, 2168Another feature of the @code{cl-loop} macro is @emph{destructuring},
2169similar in concept to the destructuring provided by @code{defmacro}. 2169similar in concept to the destructuring provided by @code{defmacro}
2170(@pxref{Argument Lists}).
2170The @var{var} part of any @code{for} clause can be given as a list 2171The @var{var} part of any @code{for} clause can be given as a list
2171of variables instead of a single variable. The values produced 2172of variables instead of a single variable. The values produced
2172during loop execution must be lists; the values in the lists are 2173during 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}
2446This clause causes the loop to return immediately. The following 2447This clause causes the loop to return immediately. The following
2447Lisp form is evaluated to give the return value of the @code{loop} 2448Lisp form is evaluated to give the return value of the loop
2448form. The @code{finally} clauses, if any, are not executed. 2449form. The @code{finally} clauses, if any, are not executed.
2449Of course, @code{return} is generally used inside an @code{if} or 2450Of 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
2451the loop would never get to ``loop'' more than once. 2452the loop would never get to ``loop'' more than once.
2452 2453
2453The clause @samp{return @var{form}} is equivalent to 2454The 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
2456was named). The @code{return} clause is implemented a bit more 2456was named). The @code{return} clause is implemented a bit more
2457efficiently, though. 2457efficiently, though.
2458@end table 2458@end table
@@ -2466,7 +2466,7 @@ clause, respectively. Consult the source code in file
2466 2466
2467This package's @code{cl-loop} macro is compatible with that of Common 2467This package's @code{cl-loop} macro is compatible with that of Common
2468Lisp, except that a few features are not implemented: @code{loop-finish} 2468Lisp, except that a few features are not implemented: @code{loop-finish}
2469and data-type specifiers. Naturally, the @code{for} clauses which 2469and data-type specifiers. Naturally, the @code{for} clauses that
2470iterate over keymaps, overlays, intervals, frames, windows, and 2470iterate over keymaps, overlays, intervals, frames, windows, and
2471buffers are Emacs-specific extensions. 2471buffers are Emacs-specific extensions.
2472 2472
@@ -2519,17 +2519,17 @@ Destructuring is made available to the user by way of the
2519following macro: 2519following macro:
2520 2520
2521@defmac cl-destructuring-bind arglist expr forms@dots{} 2521@defmac cl-destructuring-bind arglist expr forms@dots{}
2522This macro expands to code which executes @var{forms}, with 2522This macro expands to code that executes @var{forms}, with
2523the variables in @var{arglist} bound to the list of values 2523the variables in @var{arglist} bound to the list of values
2524returned by @var{expr}. The @var{arglist} can include all 2524returned by @var{expr}. The @var{arglist} can include all
2525the features allowed for @code{defmacro} argument lists, 2525the features allowed for @code{cl-defmacro} argument lists,
2526including destructuring. (The @code{&environment} keyword 2526including destructuring. (The @code{&environment} keyword
2527is not allowed.) The macro expansion will signal an error 2527is not allowed.) The macro expansion will signal an error
2528if @var{expr} returns a list of the wrong number of arguments 2528if @var{expr} returns a list of the wrong number of arguments
2529or with incorrect keyword arguments. 2529or with incorrect keyword arguments.
2530@end defmac 2530@end defmac
2531 2531
2532This package also includes the Common Lisp @code{cl-define-compiler-macro} 2532This package also includes the Common Lisp @code{define-compiler-macro}
2533facility, which allows you to define compile-time expansions and 2533facility, which allows you to define compile-time expansions and
2534optimizations for your functions. 2534optimizations for your functions.
2535 2535
@@ -2592,16 +2592,19 @@ mechanism that allows you to give the compiler special hints
2592about the types of data that will be stored in particular variables, 2592about the types of data that will be stored in particular variables,
2593and about the ways those variables and functions will be used. This 2593and about the ways those variables and functions will be used. This
2594package defines versions of all the Common Lisp declaration forms: 2594package 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},
2596and @code{cl-the}. 2596and @code{the}.
2597 2597
2598Most of the Common Lisp declarations are not currently useful in 2598Most of the Common Lisp declarations are not currently useful in Emacs
2599Emacs Lisp, as the byte-code system provides little opportunity 2599Lisp. For example, the byte-code system provides little
2600to benefit from type information, and @code{special} declarations 2600opportunity to benefit from type information.
2601are redundant in a fully dynamically-scoped Lisp. A few 2601@ignore
2602declarations are meaningful when the optimizing byte 2602and @code{special} declarations are redundant in a fully
2603compiler is being used, however. Under the earlier non-optimizing 2603dynamically-scoped Lisp.
2604compiler, these declarations will effectively be ignored. 2604@end ignore
2605A few declarations are meaningful when byte compiler optimizations
2606are enabled, as they are by the default. Otherwise these
2607declarations will effectively be ignored.
2605 2608
2606@defun cl-proclaim decl-spec 2609@defun cl-proclaim decl-spec
2607This function records a ``global'' declaration specified by 2610This 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{}
2613This macro is like @code{cl-proclaim}, except that it takes any number 2616This macro is like @code{cl-proclaim}, except that it takes any number
2614of @var{decl-spec} arguments, and the arguments are unevaluated and 2617of @var{decl-spec} arguments, and the arguments are unevaluated and
2615unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when 2618unquoted. 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
2617be registered at compile-time as well as at run-time. (This is vital, 2620be registered at compile-time as well as at run-time. (This is vital,
2618since normally the declarations are meant to influence the way the 2621since 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
2637Type information provided by @code{cl-the} is ignored in this package; 2640Type information provided by @code{cl-the} is ignored in this package;
2638in other words, @code{(cl-the @var{type} @var{form})} is equivalent 2641in other words, @code{(cl-the @var{type} @var{form})} is equivalent to
2639to @var{form}. Future versions of the optimizing byte-compiler may 2642@var{form}. Future byte-compiler optimizations may make use of this
2640make use of this information. 2643information.
2641 2644
2642For example, @code{mapcar} can map over both lists and arrays. It is 2645For example, @code{mapcar} can map over both lists and arrays. It is
2643hard for the compiler to expand @code{mapcar} into an in-line loop 2646hard for the compiler to expand @code{mapcar} into an in-line loop
@@ -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 ?
2661Since all variables in Emacs Lisp are ``special'' (in the Common 2665Since all variables in Emacs Lisp are ``special'' (in the Common
2662Lisp sense), @code{special} declarations are only advisory. They 2666Lisp sense), @code{special} declarations are only advisory. They
2663simply tell the optimizing byte compiler that the specified 2667simply tell the byte compiler that the specified
2664variables are intentionally being referred to without being 2668variables are intentionally being referred to without being
2665bound in the body of the function. The compiler normally emits 2669bound in the body of the function. The compiler normally emits
2666warnings for such references, since they could be typographical 2670warnings for such references, since they could be typographical
2667errors for references to local variables. 2671errors for references to local variables.
2668 2672
2669The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is 2673The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is
2670equivalent to @code{(defvar @var{var1}) (defvar @var{var2})} in the 2674equivalent to @code{(defvar @var{var1}) (defvar @var{var2})}.
2671optimizing compiler, or to nothing at all in older compilers (which
2672do not warn for non-local references).
2673 2675
2674In top-level contexts, it is generally better to write 2676In 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}))},
2676since @code{defvar} makes your intentions clearer. But the older 2678since @code{defvar} makes your intentions clearer.
2677byte compilers can not handle @code{defvar}s appearing inside of
2678functions, while @code{(cl-declare (special @var{var}))} takes care
2679to work correctly with all compilers.
2680 2679
2681@item inline 2680@item inline
2682The @code{inline} @var{decl-spec} lists one or more functions 2681The @code{inline} @var{decl-spec} lists one or more functions
2683whose bodies should be expanded ``in-line'' into calling functions 2682whose bodies should be expanded ``in-line'' into calling functions
2684whenever the compiler is able to arrange for it. For example, 2683whenever the compiler is able to arrange for it. For example,
2685the Common Lisp function @code{cadr} is declared @code{inline} 2684the function @code{cl-acons} is declared @code{inline}
2686by this package so that the form @code{(cadr @var{x})} will 2685by this package so that the form @code{(cl-acons @var{key} @var{value}
2687expand directly into @code{(car (cdr @var{x}))} when it is called 2686@var{alist})} will
2688in user functions, for a savings of one (relatively expensive) 2687expand directly into @code{(cons (cons @var{key} @var{value}) @var{alist})}
2689function call. 2688when it is called in user functions, so as to save function calls.
2690 2689
2691The following declarations are all equivalent. Note that the 2690The 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,
2705but it is impolite to use it to request inlining of an external 2704but it is impolite to use it to request inlining of an external
2706function. 2705function.
2707 2706
2708In Common Lisp, it is possible to use @code{(cl-declare (inline @dots{}))} 2707In Common Lisp, it is possible to use @code{(declare (inline @dots{}))}
2709before a particular call to a function to cause just that call to 2708before a particular call to a function to cause just that call to
2710be inlined; the current byte compilers provide no way to implement 2709be inlined; the current byte compilers provide no way to implement
2711this, so @code{(cl-declare (inline @dots{}))} is currently ignored by 2710this, so @code{(cl-declare (inline @dots{}))} is currently ignored by
@@ -2718,8 +2717,7 @@ declaration.
2718 2717
2719@item optimize 2718@item optimize
2720This declaration controls how much optimization is performed by 2719This declaration controls how much optimization is performed by
2721the compiler. Naturally, it is ignored by the earlier non-optimizing 2720the compiler.
2722compilers.
2723 2721
2724The word @code{optimize} is followed by any number of lists like 2722The 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
27280 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''. 27260 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''.
2729The default level for both qualities is 1. 2727The default level for both qualities is 1.
2730 2728
2731In this package, with the optimizing compiler, the 2729In this package, the @code{speed} quality is tied to the @code{byte-optimize}
2732@code{speed} quality is tied to the @code{byte-optimize}
2733flag, which is set to @code{nil} for @code{(speed 0)} and to 2730flag, which is set to @code{nil} for @code{(speed 0)} and to
2734@code{t} for higher settings; and the @code{safety} quality is 2731@code{t} for higher settings; and the @code{safety} quality is
2735tied to the @code{byte-compile-delete-errors} flag, which is 2732tied 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
2749The @code{optimize} declaration is normally used in a top-level 2746The @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
2751it to be used with @code{cl-declare} to set the level of optimization 2748it to be used with @code{declare} to set the level of optimization
2752locally for a given form, but this will not work correctly with the 2749locally for a given form, but this will not work correctly with the
2753current version of the optimizing compiler. (The @code{cl-declare} 2750current byte-compiler. (The @code{cl-declare}
2754will set the new optimization level, but that level will not 2751will set the new optimization level, but that level will not
2755automatically be unset after the enclosing form is done.) 2752automatically be unset after the enclosing form is done.)
2756 2753
2757@item warn 2754@item warn
2758This declaration controls what sorts of warnings are generated 2755This declaration controls what sorts of warnings are generated
2759by the byte compiler. Again, only the optimizing compiler 2756by the byte compiler. The word @code{warn} is followed by any
2760generates warnings. The word @code{warn} is followed by any
2761number of ``warning qualities'', similar in form to optimization 2757number of ``warning qualities'', similar in form to optimization
2762qualities. The currently supported warning types are 2758qualities. 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
2765disable these warnings and any higher value will enable them. 2761disable these warnings and any higher value will enable them.
2766See the documentation for the optimizing byte compiler for details. 2762See the documentation of the variable @code{byte-compile-warnings}
2763for 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
2878code. 2875code.
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
2882This variable holds the counter used to generate @code{cl-gensym} names. 2881This variable holds the counter used to generate @code{cl-gensym} names.
2883It is incremented after each use by @code{cl-gensym}. In Common Lisp 2882It is incremented after each use by @code{cl-gensym}. In Common Lisp
@@ -2908,13 +2907,13 @@ provided.
2908 2907
2909@noindent 2908@noindent
2910This section defines a few simple Common Lisp operations on numbers 2909This section defines a few simple Common Lisp operations on numbers
2911which were left out of Emacs Lisp. 2910that 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}.
3041This package also provides an implementation of the Common Lisp 3040This package also provides an implementation of the Common Lisp
3042random number generator. It uses its own additive-congruential 3041random number generator. It uses its own additive-congruential
3043algorithm, which is much more likely to give statistically clean 3042algorithm, which is much more likely to give statistically clean
3043@c FIXME? Still true?
3044random numbers than the simple generators supplied by many 3044random numbers than the simple generators supplied by many
3045operating systems. 3045operating systems.
3046 3046
@@ -3048,13 +3048,15 @@ operating systems.
3048This function returns a random nonnegative number less than 3048This 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).
3050The @var{state} argument should be a @code{random-state} object 3050The @var{state} argument should be a @code{random-state} object
3051which holds the state of the random number generator. The 3051that holds the state of the random number generator. The
3052function modifies this state object as a side effect. If 3052function 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
3059This variable contains the system ``default'' @code{random-state} 3061This variable contains the system ``default'' @code{random-state}
3060object, used for calls to @code{cl-random} that do not specify an 3062object, 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
3102This package defines several useful constants having to with numbers. 3104This package defines several useful constants having to do with
3105floating-point numbers.
3103 3106
3104The following parameters have to do with floating-point numbers. 3107It determines their values by exercising the computer's
3105This package determines their values by exercising the computer's
3106floating-point arithmetic in various ways. Because this operation 3108floating-point arithmetic in various ways. Because this operation
3107might be slow, the code for initializing them is kept in a separate 3109might be slow, the code for initializing them is kept in a separate
3108function that must be called before the parameters can be used. 3110function 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
3111This function makes sure that the Common Lisp floating-point parameters 3113This function makes sure that the Common Lisp floating-point parameters
3112like @code{cl-most-positive-float} have been initialized. Until it is 3114like @code{cl-most-positive-float} have been initialized. Until it is
3113called, these parameters will be @code{nil}. If this version of Emacs 3115called, these parameters will be @code{nil}.
3114does 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
3115parameters have already been initialized, the function returns 3117@c remain @code{nil}.
3118If the parameters have already been initialized, the function returns
3116immediately. 3119immediately.
3117 3120
3118The algorithm makes assumptions that will be valid for most modern 3121The algorithm makes assumptions that will be valid for almost all
3119machines, but will fail if the machine's arithmetic is extremely 3122machines, but will fail if the machine's arithmetic is extremely
3120unusual, e.g., decimal. 3123unusual, 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
3138This constant equals the most-negative value a Lisp float can hold. 3141This 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
4482code which can be improved by optimization. In particular, 4485code 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
4485optimizing compiler removes @code{cl-block}s which are not actually 4488byte-compiler removes @code{cl-block}s which are not actually
4486referenced by @code{cl-return} or @code{cl-return-from} inside the block. 4489referenced by @code{cl-return} or @code{cl-return-from} inside the block.
4487 4490
4488@node Common Lisp Compatibility 4491@node Common Lisp Compatibility