Mercurial > hg > xemacs-beta
comparison man/lispref/objects.texi @ 4471:2d39535e1f9d
Say explicitly that eq is useful for chars; xref number comparison, lispref
2008-05-27 Aidan Kehoe <kehoea@parhasard.net>
* lispref/objects.texi (Equality Predicates):
Cross reference to the section on comparison of numbers when
talking about using #'eq with integers; also mention that
#'eq gives t when passed identical integers, and that #'char= is
also available there.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 27 May 2008 11:58:42 +0200 |
parents | dc697b1b786f |
children | a99eb40f0b5b |
comparison
equal
deleted
inserted
replaced
4470:c76b1bc6bd28 | 4471:2d39535e1f9d |
---|---|
2244 This function returns @code{t} if @var{object1} and @var{object2} are | 2244 This function returns @code{t} if @var{object1} and @var{object2} are |
2245 the same object, @code{nil} otherwise. The ``same object'' means that a | 2245 the same object, @code{nil} otherwise. The ``same object'' means that a |
2246 change in one will be reflected by the same change in the other. | 2246 change in one will be reflected by the same change in the other. |
2247 | 2247 |
2248 @code{eq} returns @code{t} if @var{object1} and @var{object2} are | 2248 @code{eq} returns @code{t} if @var{object1} and @var{object2} are |
2249 integers with the same value. Also, since symbol names are normally | 2249 integers with the same value. It is preferable to use @code{=} or |
2250 unique, if the arguments are symbols with the same name, they are | 2250 @code{eql} in many contexts for numeric comparison; @pxref{Comparison of |
2251 @code{eq}. For other types (e.g., lists, vectors, strings), two | 2251 Numbers}. @code{eq} also returns @code{t} if @var{object1} and |
2252 arguments with the same contents or elements are not necessarily | 2252 @var{object2} are identical characters, though in this case you may |
2253 @code{eq} to each other: they are @code{eq} only if they are the same | 2253 prefer to use @code{char=}. |
2254 object. | 2254 |
2255 Also, since symbol names are normally unique, if the arguments are | |
2256 symbols with the same name, they are @code{eq}. For other types (e.g., | |
2257 lists, vectors, strings), two arguments with the same contents or | |
2258 elements are not necessarily @code{eq} to each other: they are @code{eq} | |
2259 only if they are the same object. | |
2255 | 2260 |
2256 (The @code{make-symbol} function returns an uninterned symbol that is | 2261 (The @code{make-symbol} function returns an uninterned symbol that is |
2257 not interned in the standard @code{obarray}. When uninterned symbols | 2262 not interned in the standard @code{obarray}. When uninterned symbols |
2258 are in use, symbol names are no longer unique. Distinct symbols with | 2263 are in use, symbol names are no longer unique. Distinct symbols with |
2259 the same name are not @code{eq}. @xref{Creating Symbols}.) | 2264 the same name are not @code{eq}. @xref{Creating Symbols}.) |
2260 | 2265 |
2261 NOTE: Under XEmacs 19, characters are really just integers, and thus | 2266 NOTE: Under XEmacs 19, characters are really just integers, and thus |
2262 characters and integers are @code{eq}. Under XEmacs 20, it was | 2267 characters and integers with the same numeric are @code{eq}. Under |
2263 necessary to preserve remnants of this in function such as @code{old-eq} | 2268 XEmacs 20, it was necessary to preserve remnants of this in function |
2264 in order to maintain byte-code compatibility. Byte code compiled | 2269 such as @code{old-eq} in order to maintain byte-code compatibility. |
2265 under any Emacs 19 will automatically have calls to @code{eq} mapped | 2270 Byte code compiled under any Emacs 19 will automatically have calls to |
2266 to @code{old-eq} when executed under XEmacs 20. | 2271 @code{eq} mapped to @code{old-eq} when executed under XEmacs 20. |
2267 | 2272 |
2268 @example | 2273 @example |
2269 @group | 2274 @group |
2270 (eq 'foo 'foo) | 2275 (eq 'foo 'foo) |
2271 @result{} t | 2276 @result{} t |