comparison lisp/cl.el @ 5475:248176c74e6b

Merge with trunk.
author Mats Lidell <matsl@xemacs.org>
date Sat, 23 Apr 2011 23:47:13 +0200
parents 00e79bbbe48f 25c10648ffba
children f2881cb841b4
comparison
equal deleted inserted replaced
5474:4dee0387b9de 5475:248176c74e6b
308 "Return t if NUMBER is negative." 308 "Return t if NUMBER is negative."
309 (< number 0)) 309 (< number 0))
310 310
311 (defun oddp (integer) 311 (defun oddp (integer)
312 "Return t if INTEGER is odd." 312 "Return t if INTEGER is odd."
313 (eq (logand integer 1) 1)) 313 (eql (logand integer 1) 1))
314 314
315 (defun evenp (integer) 315 (defun evenp (integer)
316 "Return t if INTEGER is even." 316 "Return t if INTEGER is even."
317 (eq (logand integer 1) 0)) 317 (eql (logand integer 1) 0))
318 318
319 ;; XEmacs addition 319 ;; XEmacs addition
320 (defalias 'cl-abs 'abs) 320 (defalias 'cl-abs 'abs)
321 321
322 (defvar *random-state* (vector 'cl-random-state-tag -1 30 (cl-random-time))) 322 (defvar *random-state* (vector 'cl-random-state-tag -1 30 (cl-random-time)))
325 (defconst most-positive-float nil 325 (defconst most-positive-float nil
326 "The float closest in value to positive infinity.") 326 "The float closest in value to positive infinity.")
327 (defconst most-negative-float nil 327 (defconst most-negative-float nil
328 "The float closest in value to negative infinity.") 328 "The float closest in value to negative infinity.")
329 (defconst least-positive-float nil 329 (defconst least-positive-float nil
330 "The positive float closest in value to 0.") 330 "The positive float closest in value to zero.")
331 (defconst least-negative-float nil 331 (defconst least-negative-float nil
332 "The negative float closest in value to 0.") 332 "The negative float closest in value to zero.")
333 (defconst least-positive-normalized-float nil) 333 (defconst least-positive-normalized-float nil
334 (defconst least-negative-normalized-float nil) 334 "The normalized positive float closest in value to zero.
335 (defconst float-epsilon nil) 335
336 (defconst float-negative-epsilon nil) 336 A float is normalized if the most significant bit of its mantissa is 1.
337 Use of denormalized (equivalently, subnormal) floats in calculations will
338 lead to gradual underflow, though they can be more accurate in representing
339 individual small values. Normal and subnormal floats are as described in
340 IEEE 754.")
341
342 (defconst least-negative-normalized-float nil
343 "The normalized negative float closest in value to zero.
344
345 See `least-positive-normalized-float' for details of normal and denormalized
346 numbers.")
347
348 (defconst float-epsilon nil
349 "The smallest float guaranteed not `eql' to 1.0 when added to 1.0.
350
351 That is, (eql 1.0 (+ 1.0 X)) will always give nil if (<= float-epsilon X) ,
352 but it may give t for smaller values.")
353
354 (defconst float-negative-epsilon nil
355 "The smallest float guaranteed not `eql' to 1.0 when subtracted from 1.0.
356
357 That is, (eql 1.0 (- 1.0 X)) will always give nil if (<=
358 float-negative-epsilon X) , but it may give t for smaller values.")
337 359
338 ;;; Sequence functions. 360 ;;; Sequence functions.
339 361
340 (defalias 'copy-seq 'copy-sequence) 362 (defalias 'copy-seq 'copy-sequence)
341 363
399 (defun caar (x) 421 (defun caar (x)
400 "Return the `car' of the `car' of X." 422 "Return the `car' of the `car' of X."
401 (car (car x))) 423 (car (car x)))
402 424
403 (defun cadr (x) 425 (defun cadr (x)
404 "Return the `car' of the `cdr' of X." 426 "Return the `car' of the `cdr' of X. Equivalent to `(second X)'."
405 (car (cdr x))) 427 (car (cdr x)))
406 428
407 (defun cdar (x) 429 (defun cdar (x)
408 "Return the `cdr' of the `car' of X." 430 "Return the `cdr' of the `car' of X."
409 (cdr (car x))) 431 (cdr (car x)))
423 (defun cadar (x) 445 (defun cadar (x)
424 "Return the `car' of the `cdr' of the `car' of X." 446 "Return the `car' of the `cdr' of the `car' of X."
425 (car (cdr (car x)))) 447 (car (cdr (car x))))
426 448
427 (defun caddr (x) 449 (defun caddr (x)
428 "Return the `car' of the `cdr' of the `cdr' of X." 450 "Return the `car' of the `cdr' of the `cdr' of X.
451 Equivalent to `(third X)'."
429 (car (cdr (cdr x)))) 452 (car (cdr (cdr x))))
430 453
431 (defun cdaar (x) 454 (defun cdaar (x)
432 "Return the `cdr' of the `car' of the `car' of X." 455 "Return the `cdr' of the `car' of the `car' of X."
433 (cdr (car (car x)))) 456 (cdr (car (car x))))
471 (defun caddar (x) 494 (defun caddar (x)
472 "Return the `car' of the `cdr' of the `cdr' of the `car' of X." 495 "Return the `car' of the `cdr' of the `cdr' of the `car' of X."
473 (car (cdr (cdr (car x))))) 496 (car (cdr (cdr (car x)))))
474 497
475 (defun cadddr (x) 498 (defun cadddr (x)
476 "Return the `car' of the `cdr' of the `cdr' of the `cdr' of X." 499 "Return the `car' of the `cdr' of the `cdr' of the `cdr' of X.
500 Equivalent to `(fourth X)'."
477 (car (cdr (cdr (cdr x))))) 501 (car (cdr (cdr (cdr x)))))
478 502
479 (defun cdaaar (x) 503 (defun cdaaar (x)
480 "Return the `cdr' of the `car' of the `car' of the `car' of X." 504 "Return the `cdr' of the `car' of the `car' of the `car' of X."
481 (cdr (car (car (car x))))) 505 (cdr (car (car (car x)))))