comparison man/lispref/numbers.texi @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 05472e90ae02
children 54cc21c15cbb
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
196 floating point), and returns @code{t} if so, @code{nil} otherwise. 196 floating point), and returns @code{t} if so, @code{nil} otherwise.
197 @end defun 197 @end defun
198 198
199 @defun natnump object 199 @defun natnump object
200 @cindex natural numbers 200 @cindex natural numbers
201 The @code{natnump} predicate (whose name comes from the phrase 201 The @code{wholenump} predicate (whose name comes from the phrase
202 ``natural-number-p'') tests to see whether its argument is a nonnegative 202 ``natural-number-p'') tests to see whether its argument is a nonnegative
203 integer, and returns @code{t} if so, @code{nil} otherwise. 0 is 203 integer, and returns @code{t} if so, @code{nil} otherwise. 0 is
204 considered non-negative. 204 considered non-negative.
205 @end defun 205 @end defun
206 206
221 compare them, then you test whether two values are the same 221 compare them, then you test whether two values are the same
222 @emph{object}. By contrast, @code{=} compares only the numeric values 222 @emph{object}. By contrast, @code{=} compares only the numeric values
223 of the objects. 223 of the objects.
224 224
225 At present, each integer value has a unique Lisp object in XEmacs Lisp. 225 At present, each integer value has a unique Lisp object in XEmacs Lisp.
226 Therefore, @code{eq} is equivalent to @code{=} where integers are 226 Therefore, @code{eq} is equivalent @code{=} where integers are
227 concerned. It is sometimes convenient to use @code{eq} for comparing an 227 concerned. It is sometimes convenient to use @code{eq} for comparing an
228 unknown value with an integer, because @code{eq} does not report an 228 unknown value with an integer, because @code{eq} does not report an
229 error if the unknown value is not a number---it accepts arguments of any 229 error if the unknown value is not a number---it accepts arguments of any
230 type. By contrast, @code{=} signals an error if the arguments are not 230 type. By contrast, @code{=} signals an error if the arguments are not
231 numbers or markers. However, it is a good idea to use @code{=} if you 231 numbers or markers. However, it is a good idea to use @code{=} if you
393 393
394 @example 394 @example
395 (setq foo (1+ foo)) 395 (setq foo (1+ foo))
396 @result{} 5 396 @result{} 5
397 @end example 397 @end example
398
399 Now that the @code{cl} package is always available from lisp code, a
400 more convenient and natural way to increment a variable is
401 @w{@code{(incf foo)}}.
402 @end defun 398 @end defun
403 399
404 @defun 1- number-or-marker 400 @defun 1- number-or-marker
405 This function returns @var{number-or-marker} minus 1. 401 This function returns @var{number-or-marker} minus 1.
406 @end defun 402 @end defun