comparison lisp/cl.el @ 446:1ccc32a20af4 r21-2-38

Import from CVS: tag r21-2-38
author cvs
date Mon, 13 Aug 2007 11:37:21 +0200
parents abe6d1db359e
children 023b83f4e54b
comparison
equal deleted inserted replaced
445:34f3776fcf0e 446:1ccc32a20af4
335 (setq *gensym-counter* (1+ *gensym-counter*))) 335 (setq *gensym-counter* (1+ *gensym-counter*)))
336 (intern name))) 336 (intern name)))
337 337
338 ;;; Numbers. 338 ;;; Numbers.
339 339
340 (defun floatp-safe (x) 340 (defun floatp-safe (object)
341 "Return t if OBJECT is a floating point number. 341 "Return t if OBJECT is a floating point number."
342 On Emacs versions that lack floating-point support, this function 342 (floatp object))
343 always returns nil." 343
344 ;;(and (numberp x) (not (integerp x))) 344 (defun plusp (number)
345 ;; XEmacs: use floatp. XEmacs is always compiled with
346 ;; floating-point, anyway.
347 (floatp x))
348
349 (defun plusp (x)
350 "Return t if NUMBER is positive." 345 "Return t if NUMBER is positive."
351 (> x 0)) 346 (> number 0))
352 347
353 (defun minusp (x) 348 (defun minusp (number)
354 "Return t if NUMBER is negative." 349 "Return t if NUMBER is negative."
355 (< x 0)) 350 (< number 0))
356 351
357 (defun oddp (x) 352 (defun oddp (integer)
358 "Return t if INTEGER is odd." 353 "Return t if INTEGER is odd."
359 (eq (logand x 1) 1)) 354 (eq (logand integer 1) 1))
360 355
361 (defun evenp (x) 356 (defun evenp (integer)
362 "Return t if INTEGER is even." 357 "Return t if INTEGER is even."
363 (eq (logand x 1) 0)) 358 (eq (logand integer 1) 0))
364 359
365 (defun cl-abs (x) 360 (defun cl-abs (number)
366 "Return the absolute value of ARG." 361 "Return the absolute value of NUMBER."
367 (if (>= x 0) x (- x))) 362 (if (>= number 0) number (- number)))
368 (or (fboundp 'abs) (defalias 'abs 'cl-abs)) ; This is built-in to Emacs 19 363 (or (fboundp 'abs) (defalias 'abs 'cl-abs)) ; This is built-in to Emacs 19
369 364
370 (defvar *random-state* (vector 'cl-random-state-tag -1 30 (cl-random-time))) 365 (defvar *random-state* (vector 'cl-random-state-tag -1 30 (cl-random-time)))
371 366
372 ;;; We use `eval' in case VALBITS differs from compile-time to load-time. 367 ;;; We use `eval' in case VALBITS differs from compile-time to load-time.