comparison lisp/cl-extra.el @ 5257:30bf66dd3ca0

Add fixnum as an accepted destination type, #'coerce 2010-09-03 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (coerce): Add fixnum as an accepted destination type.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 03 Sep 2010 17:14:10 +0100
parents f3eca926258e
children 799742b751c8
comparison
equal deleted inserted replaced
5256:6c8f5574d4a1 5257:30bf66dd3ca0
62 ((eq type 'array) (if (arrayp x) x (vconcat x))) 62 ((eq type 'array) (if (arrayp x) x (vconcat x)))
63 ((and (eq type 'character) (stringp x) (= (length x) 1)) (aref x 0)) 63 ((and (eq type 'character) (stringp x) (= (length x) 1)) (aref x 0))
64 ((and (eq type 'character) (symbolp x)) (coerce (symbol-name x) type)) 64 ((and (eq type 'character) (symbolp x)) (coerce (symbol-name x) type))
65 ;; XEmacs addition character <-> integer coercions 65 ;; XEmacs addition character <-> integer coercions
66 ((and (eq type 'character) (char-int-p x)) (int-char x)) 66 ((and (eq type 'character) (char-int-p x)) (int-char x))
67 ((and (eq type 'integer) (characterp x)) (char-int x)) 67 ((and (memq type '(integer fixnum)) (characterp x)) (char-int x))
68 ((eq type 'float) (float x)) 68 ((eq type 'float) (float x))
69 ;; XEmacs addition: enhanced numeric type coercions 69 ;; XEmacs addition: enhanced numeric type coercions
70 ((and-fboundp 'coerce-number 70 ((and-fboundp 'coerce-number
71 (memq type '(integer ratio bigfloat)) 71 (memq type '(integer ratio bigfloat fixnum))
72 (coerce-number x type))) 72 (coerce-number x type)))
73 ;; XEmacs addition: bit-vector coercion 73 ;; XEmacs addition: bit-vector coercion
74 ((or (eq type 'bit-vector) 74 ((or (eq type 'bit-vector)
75 (eq type 'simple-bit-vector)) 75 (eq type 'simple-bit-vector))
76 (if (bit-vector-p x) x (apply 'bit-vector (append x nil)))) 76 (if (bit-vector-p x) x (apply 'bit-vector (append x nil))))