X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/db78a8cb1ea479e4c556e43260f204b7ef10aa7c..6d52677de1d02de37c0ae4b716c306ffc8de75b4:/doc/misc/cl.texi diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index c27021cb32..60a1e055f3 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -5,26 +5,20 @@ @copying This file documents the GNU Emacs Common Lisp emulation package. -Copyright @copyright{} 1993, 2001, 2002, 2003, 2004, 2005, 2006, 2007 -Free Software Foundation, Inc. +Copyright @copyright{} 1993, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +2008 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no -Invariant Sections, with the Front-Cover texts being ``A GNU -Manual'', and with the Back-Cover Texts as in (a) below. A copy of the -license is included in the section entitled ``GNU Free Documentation -License'' in the Emacs manual. - -(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify -this GNU Manual, like GNU software. Copies published by the Free -Software Foundation raise funds for GNU development.'' - -This document is part of a collection distributed under the GNU Free -Documentation License. If you want to distribute this document -separately from the collection, you can do so by adding a copy of the -license to the document, as described in section 6 of the license. +Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', +and with the Back-Cover Texts as in (a) below. A copy of the license +is included in the section entitled ``GNU Free Documentation License''. + +(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and +modify this GNU manual. Buying copies from the FSF supports it in +developing GNU and promoting software freedom.'' @end quotation @end copying @@ -62,14 +56,14 @@ does assume a basic familiarity with Emacs Lisp. @menu * Overview:: Installation, usage, etc. * Program Structure:: Arglists, `eval-when', `defalias' -* Predicates:: `typep', `eql', and `equalp' +* Predicates:: `typep' and `equalp' * Control Structure:: `setf', `do', `loop', etc. * Macros:: Destructuring, `define-compiler-macro' * Declarations:: `proclaim', `declare', etc. * Symbols:: Property lists, `gensym' * Numbers:: Predicates, functions, random numbers * Sequences:: Mapping, functions, searching, sorting -* Lists:: `cadr', `sublis', `member*', `assoc*', etc. +* Lists:: `caddr', `sublis', `member*', `assoc*', etc. * Structures:: `defstruct' * Assertions:: `check-type', `assert', `ignore-errors'. @@ -287,7 +281,7 @@ The following simple functions and macros are defined in @file{cl.el}; they do not cause other components like @file{cl-extra} to be loaded. @example -eql floatp-safe endp +floatp-safe endp evenp oddp plusp minusp caaar .. cddddr list* ldiff rest first .. tenth @@ -700,7 +694,7 @@ facts are true or false. @menu * Type Predicates:: `typep', `deftype', and `coerce' -* Equality Predicates:: `eql' and `equalp' +* Equality Predicates:: `equalp' @end menu @node Type Predicates, Equality Predicates, Predicates, Predicates @@ -840,40 +834,7 @@ arguments to specify the type of sequence to return. @xref{Sequences}. @section Equality Predicates @noindent -This package defines two Common Lisp predicates, @code{eql} and -@code{equalp}. - -@defun eql a b -This function is almost the same as @code{eq}, except that if @var{a} -and @var{b} are numbers of the same type, it compares them for numeric -equality (as if by @code{equal} instead of @code{eq}). This makes a -difference only for versions of Emacs that are compiled with -floating-point support. Emacs floats are allocated -objects just like cons cells, which means that @code{(eq 3.0 3.0)} -will not necessarily be true---if the two @code{3.0}s were allocated -separately, the pointers will be different even though the numbers are -the same. But @code{(eql 3.0 3.0)} will always be true. - -The types of the arguments must match, so @code{(eql 3 3.0)} is -still false. - -Note that Emacs integers are ``direct'' rather than allocated, which -basically means @code{(eq 3 3)} will always be true. Thus @code{eq} -and @code{eql} behave differently only if floating-point numbers are -involved, and are indistinguishable on Emacs versions that don't -support floats. - -There is a slight inconsistency with Common Lisp in the treatment of -positive and negative zeros. Some machines, notably those with IEEE -standard arithmetic, represent @code{+0} and @code{-0} as distinct -values. Normally this doesn't matter because the standard specifies -that @code{(= 0.0 -0.0)} should always be true, and this is indeed -what Emacs Lisp and Common Lisp do. But the Common Lisp standard -states that @code{(eql 0.0 -0.0)} and @code{(equal 0.0 -0.0)} should -be false on IEEE-like machines; Emacs Lisp does not do this, and in -fact the only known way to distinguish between the two zeros in Emacs -Lisp is to @code{format} them and check for a minus sign. -@end defun +This package defines the Common Lisp predicate @code{equalp}. @defun equalp a b This function is a more flexible version of @code{equal}. In @@ -2504,7 +2465,8 @@ hash table entry. @item for @var{var} being the key-codes of @var{keymap} This clause iterates over the entries in @var{keymap}. -The iteration does not enter nested keymaps or inherited (parent) keymaps. +The iteration does not enter nested keymaps but does enter inherited +(parent) keymaps. You can use @samp{the key-bindings} to access the commands bound to the keys rather than the key codes, and you can add a @code{using} clause to access both the codes and the bindings together. @@ -2631,7 +2593,7 @@ This clause simply counts up to the specified number using an internal temporary variable. The loops @example -(loop repeat n do ...) +(loop repeat (1+ n) do ...) (loop for temp to n do ...) @end example @@ -3685,7 +3647,7 @@ the same sequence, in the same order as they appear in that sequence.) The @code{:test} argument specifies a function which must return true (non-@code{nil}) to indicate a match; instead, you may use @code{:test-not} to give a function which returns @emph{false} to -indicate a match. The default test function is @code{:test 'eql}. +indicate a match. The default test function is @code{eql}. Many functions which take @var{item} and @code{:test} or @code{:test-not} arguments also come in @code{-if} and @code{-if-not} varieties, @@ -4998,7 +4960,7 @@ which understand full-featured argument lists. The @code{&whole} keyword does not work in @code{defmacro} argument lists (except inside recursive argument lists). -The @code{eql} and @code{equal} predicates do not distinguish +The @code{equal} predicate does not distinguish between IEEE floating-point plus and minus zero. The @code{equalp} predicate has several differences with Common Lisp; @pxref{Predicates}. @@ -5218,12 +5180,6 @@ whereas Emacs Lisp's parser just treats quote as a special case. Some Lisp packages use reader macros to create special syntaxes for themselves, which the Emacs parser is incapable of reading. -The lack of reader macros, incidentally, is the reason behind -Emacs Lisp's unusual backquote syntax. Since backquotes are -implemented as a Lisp package and not built-in to the Emacs -parser, they are forced to use a regular macro named @code{`} -which is used with the standard function/macro call notation. - @item Other syntactic features. Common Lisp provides a number of notations beginning with @code{#} that the Emacs Lisp parser @@ -5287,11 +5243,11 @@ matters, Emacs has its own @code{#(} notation for something entirely different---strings with properties. @item -Characters are distinct from integers in Common Lisp. The -notation for character constants is also different: @code{#\A} -instead of @code{?A}. Also, @code{string=} and @code{string-equal} -are synonyms in Emacs Lisp whereas the latter is case-insensitive -in Common Lisp. +Characters are distinct from integers in Common Lisp. The notation +for character constants is also different: @code{#\A} in Common Lisp +where Emacs Lisp uses @code{?A}. Also, @code{string=} and +@code{string-equal} are synonyms in Emacs Lisp, whereas the latter is +case-insensitive in Common Lisp. @item Data types. Some Common Lisp data types do not exist in Emacs