comparison lisp/cl-macs.el @ 5305:09fed7053634

Handle slightly more complex type specifications, #'coerce, #'typep. 2010-11-17 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (coerce): In the argument list, name the first argument OBJECT, not X; the former name was always used in the doc string and is clearer. Handle vector type specifications which include the length of the target sequence, error if there's a mismatch. * cl-macs.el (cl-make-type-test): Handle type specifications starting with the symbol 'eql.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 17 Nov 2010 14:30:03 +0000
parents ec05a30f7148
children 5ed261fd2bd9 8d29f1c4bb98
comparison
equal deleted inserted replaced
5304:6784adb405ad 5305:09fed7053634
3114 (cons (car type) 3114 (cons (car type)
3115 (mapcar #'(lambda (x) (cl-make-type-test val x)) 3115 (mapcar #'(lambda (x) (cl-make-type-test val x))
3116 (cdr type)))) 3116 (cdr type))))
3117 ((memq (car-safe type) '(member member*)) 3117 ((memq (car-safe type) '(member member*))
3118 (list 'and (list 'member* val (list 'quote (cdr type))) t)) 3118 (list 'and (list 'member* val (list 'quote (cdr type))) t))
3119 ((eq (car-safe type) 'eql)
3120 (list 'eql (cadr type) val))
3119 ((eq (car-safe type) 'satisfies) (list (cadr type) val)) 3121 ((eq (car-safe type) 'satisfies) (list (cadr type) val))
3120 (t (error "Bad type spec: %s" type))))) 3122 (t (error "Bad type spec: %s" type)))))
3121 3123
3122 ;;;###autoload 3124 ;;;###autoload
3123 (defun typep (object type) ; See compiler macro below. 3125 (defun typep (object type) ; See compiler macro below.