comparison lisp/cl-macs.el @ 5346:b4ef3128160c

Fix some testsuite failures, #'delete, #'delq, #'remove, #'remq. lisp/ChangeLog addition: 2011-01-23 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (delete): * cl-macs.el (delq): * cl-macs.el (remove): * cl-macs.el (remq): Don't use the compiler macro if these functions were given the wrong number of arguments, as happens in lisp-tests.el. * cl-seq.el (remove, remq): Removed. I added these to subr.el, and forgot to remove them from here. tests/ChangeLog addition: 2011-01-23 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el (test-fun): #'delete* and friends can now throw a wrong-type-argument if handed a non-sequence; accept this too when checking for an error when passing a fixnum as the SEQUENCE argument. Check #'remove*, #'remove and #'remq too.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 23 Jan 2011 13:13:54 +0000
parents 174aed57a32a
children 38e24b8be4ea
comparison
equal deleted inserted replaced
5345:db326b8fe982 5346:b4ef3128160c
3342 (not (memq :key keys))) 3342 (not (memq :key keys)))
3343 (list 'if (list* 'member* a list keys) list (list 'cons a list)) 3343 (list 'if (list* 'member* a list keys) list (list 'cons a list))
3344 form)) 3344 form))
3345 3345
3346 (define-compiler-macro delete (&whole form &rest args) 3346 (define-compiler-macro delete (&whole form &rest args)
3347 (symbol-macrolet 3347 (if (eql 3 (length form))
3348 ((not-constant '#:not-constant)) 3348 (symbol-macrolet ((not-constant '#:not-constant))
3349 (let ((cl-const-expr-val (cl-const-expr-val (nth 1 form) not-constant))) 3349 (let ((cl-const-expr-val (cl-const-expr-val (nth 1 form) not-constant)))
3350 (if (and (cdr form) (not (eq not-constant cl-const-expr-val)) 3350 (if (and (cdr form) (not (eq not-constant cl-const-expr-val))
3351 (or (symbolp cl-const-expr-val) (fixnump cl-const-expr-val) 3351 (or (symbolp cl-const-expr-val) (fixnump cl-const-expr-val)
3352 (characterp cl-const-expr-val))) 3352 (characterp cl-const-expr-val)))
3353 (cons 'delete* (cdr form)) 3353 (cons 'delete* (cdr form))
3354 `(delete* ,@(cdr form) :test #'equal))))) 3354 `(delete* ,@(cdr form) :test #'equal))))
3355 form))
3355 3356
3356 (define-compiler-macro delq (&whole form &rest args) 3357 (define-compiler-macro delq (&whole form &rest args)
3357 (symbol-macrolet 3358 (if (eql 3 (length form))
3358 ((not-constant '#:not-constant)) 3359 (symbol-macrolet
3359 (let ((cl-const-expr-val (cl-const-expr-val (nth 1 form) not-constant))) 3360 ((not-constant '#:not-constant))
3360 (if (and (cdr form) (not (eq not-constant cl-const-expr-val)) 3361 (let ((cl-const-expr-val (cl-const-expr-val (nth 1 form) not-constant)))
3361 (not (cl-non-fixnum-number-p cl-const-expr-val))) 3362 (if (and (cdr form) (not (eq not-constant cl-const-expr-val))
3362 (cons 'delete* (cdr form)) 3363 (not (cl-non-fixnum-number-p cl-const-expr-val)))
3363 `(delete* ,@(cdr form) :test #'eq))))) 3364 (cons 'delete* (cdr form))
3365 `(delete* ,@(cdr form) :test #'eq))))
3366 form))
3364 3367
3365 (define-compiler-macro remove (&whole form &rest args) 3368 (define-compiler-macro remove (&whole form &rest args)
3366 (symbol-macrolet 3369 (if (eql 3 (length form))
3367 ((not-constant '#:not-constant)) 3370 (symbol-macrolet
3368 (let ((cl-const-expr-val (cl-const-expr-val (nth 1 form) not-constant))) 3371 ((not-constant '#:not-constant))
3369 (if (and (cdr form) (not (eq not-constant cl-const-expr-val)) 3372 (let ((cl-const-expr-val (cl-const-expr-val (nth 1 form) not-constant)))
3370 (or (symbolp cl-const-expr-val) (fixnump cl-const-expr-val) 3373 (if (and (cdr form) (not (eq not-constant cl-const-expr-val))
3371 (characterp cl-const-expr-val))) 3374 (or (symbolp cl-const-expr-val) (fixnump cl-const-expr-val)
3372 (cons 'remove* (cdr form)) 3375 (characterp cl-const-expr-val)))
3373 `(remove* ,@(cdr form) :test #'equal))))) 3376 (cons 'remove* (cdr form))
3377 `(remove* ,@(cdr form) :test #'equal))))
3378 form))
3374 3379
3375 (define-compiler-macro remq (&whole form &rest args) 3380 (define-compiler-macro remq (&whole form &rest args)
3376 (symbol-macrolet 3381 (if (eql 3 (length form))
3377 ((not-constant '#:not-constant)) 3382 (symbol-macrolet
3378 (let ((cl-const-expr-val (cl-const-expr-val (nth 1 form) not-constant))) 3383 ((not-constant '#:not-constant))
3379 (if (and (cdr form) (not (eq not-constant cl-const-expr-val)) 3384 (let ((cl-const-expr-val (cl-const-expr-val (nth 1 form) not-constant)))
3380 (not (cl-non-fixnum-number-p cl-const-expr-val))) 3385 (if (and (cdr form) (not (eq not-constant cl-const-expr-val))
3381 (cons 'remove* (cdr form)) 3386 (not (cl-non-fixnum-number-p cl-const-expr-val)))
3382 `(remove* ,@(cdr form) :test #'eq))))) 3387 (cons 'remove* (cdr form))
3388 `(remove* ,@(cdr form) :test #'eq))))
3389 form))
3383 3390
3384 (macrolet 3391 (macrolet
3385 ((define-foo-if-compiler-macros (&rest alist) 3392 ((define-foo-if-compiler-macros (&rest alist)
3386 "Avoid the funcall, variable binding and keyword parsing overhead 3393 "Avoid the funcall, variable binding and keyword parsing overhead
3387 for the FOO-IF and FOO-IF-NOT functions, transforming to forms using the 3394 for the FOO-IF and FOO-IF-NOT functions, transforming to forms using the