comparison man/lispref/numbers.texi @ 54:05472e90ae02 r19-16-pre2

Import from CVS: tag r19-16-pre2
author cvs
date Mon, 13 Aug 2007 08:57:55 +0200
parents 376386a54a3c
children 131b0175ea99
comparison
equal deleted inserted replaced
53:875393c1a535 54:05472e90ae02
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{wholenump} predicate (whose name comes from the phrase 201 The @code{natnump} 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 @code{=} where integers are 226 Therefore, @code{eq} is equivalent to @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
259 This function tests whether its arguments are numerically equal, and 259 This function tests whether its arguments are numerically equal, and
260 returns @code{t} if so, @code{nil} otherwise. 260 returns @code{t} if so, @code{nil} otherwise.
261 @end defun 261 @end defun
262 262
263 @defun /= number-or-marker1 number-or-marker2 263 @defun /= number-or-marker1 number-or-marker2
264 This function tests whether its arguments are numerically equal, and 264 This function tests whether its arguments are numerically not equal. It
265 returns @code{t} if they are not, and @code{nil} if they are. 265 returns @code{t} if so, and @code{nil} otherwise.
266 @end defun 266 @end defun
267 267
268 @defun < number-or-marker1 number-or-marker2 268 @defun < number-or-marker1 number-or-marker2
269 This function tests whether its first argument is strictly less than 269 This function tests whether its first argument is strictly less than
270 its second argument. It returns @code{t} if so, @code{nil} otherwise. 270 its second argument. It returns @code{t} if so, @code{nil} otherwise.
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)}}.
398 @end defun 402 @end defun
399 403
400 @defun 1- number-or-marker 404 @defun 1- number-or-marker
401 This function returns @var{number-or-marker} minus 1. 405 This function returns @var{number-or-marker} minus 1.
402 @end defun 406 @end defun