comparison lisp/cl-seq.el @ 5242:f3eca926258e

Bit vectors are also sequences; enforce this in some CL functions. lisp/ChangeLog addition: 2010-07-24 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (concatenate): * cl-seq.el (remove*, cl-delete-duplicates): Bit vectors are also sequences; enforce this in these functions. * cl-macs.el (concatenate): If TYPE is constant, don't inline #'concatenate, replace it by a call to the appropriate C functions.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 24 Jul 2010 17:38:35 +0100
parents fbd1485af104
children 69f687b3ba9d
comparison
equal deleted inserted replaced
5241:d579d76f3dcc 5242:f3eca926258e
213 (let ((cl-res (apply 'delete* cl-item (append cl-seq nil) 213 (let ((cl-res (apply 'delete* cl-item (append cl-seq nil)
214 (append (if cl-from-end 214 (append (if cl-from-end
215 (list :end (1+ cl-i)) 215 (list :end (1+ cl-i))
216 (list :start cl-i)) 216 (list :start cl-i))
217 cl-keys)))) 217 cl-keys))))
218 (if (listp cl-seq) cl-res 218 (typecase cl-seq
219 (if (stringp cl-seq) (concat cl-res) (vconcat cl-res)))) 219 (list cl-res)
220 (string (concat cl-res))
221 (vector (vconcat cl-res))
222 (bit-vector (bvconcat cl-res))))
220 cl-seq)) 223 cl-seq))
221 (setq cl-end (- (or cl-end 8000000) cl-start)) 224 (setq cl-end (- (or cl-end 8000000) cl-start))
222 (if (= cl-start 0) 225 (if (= cl-start 0)
223 (while (and cl-seq (> cl-end 0) 226 (while (and cl-seq (> cl-end 0)
224 (cl-check-test cl-item (car cl-seq)) 227 (cl-check-test cl-item (car cl-seq))
380 (setcdr cl-p (cdr (cdr cl-p)))) 383 (setcdr cl-p (cdr (cdr cl-p))))
381 (setq cl-p (cdr cl-p))) 384 (setq cl-p (cdr cl-p)))
382 (setq cl-end (1- cl-end) cl-start (1+ cl-start))) 385 (setq cl-end (1- cl-end) cl-start (1+ cl-start)))
383 cl-seq))) 386 cl-seq)))
384 (let ((cl-res (cl-delete-duplicates (append cl-seq nil) cl-keys nil))) 387 (let ((cl-res (cl-delete-duplicates (append cl-seq nil) cl-keys nil)))
385 (if (stringp cl-seq) (concat cl-res) (vconcat cl-res))))) 388 (typecase cl-seq
389 (string (concat cl-res))
390 (vector (vconcat cl-res))
391 (bit-vector (bvconcat cl-res))))))
386 392
387 (defun substitute (cl-new cl-old cl-seq &rest cl-keys) 393 (defun substitute (cl-new cl-old cl-seq &rest cl-keys)
388 "Substitute NEW for OLD in SEQ. 394 "Substitute NEW for OLD in SEQ.
389 This is a non-destructive function; it makes a copy of SEQ if necessary 395 This is a non-destructive function; it makes a copy of SEQ if necessary
390 to avoid corrupting the original SEQ. 396 to avoid corrupting the original SEQ.