Function: cl--delete-duplicates
cl--delete-duplicates is a byte-compiled function defined in
cl-seq.el.gz.
Signature
(cl--delete-duplicates CL-SEQ CL-KEYS CL-COPY)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-seq.el.gz
(defun cl--delete-duplicates (cl-seq cl-keys cl-copy)
(if (listp cl-seq)
(cl--parsing-keywords
;; We need to parse :if, otherwise `cl-if' is unbound.
(:test :test-not :key (:start 0) :end :from-end :if)
()
(if cl-from-end
(let ((cl-p (nthcdr cl-start cl-seq)) cl-i)
(setq cl-end (- (or cl-end (length cl-seq)) cl-start))
(while (> cl-end 1)
(setq cl-i 0)
(while (setq cl-i (cl--position (cl--check-key (car cl-p))
(cdr cl-p) cl-i (1- cl-end)))
(if cl-copy (setq cl-seq (copy-sequence cl-seq)
cl-p (nthcdr cl-start cl-seq) cl-copy nil))
(let ((cl-tail (nthcdr cl-i cl-p)))
(setcdr cl-tail (cdr (cdr cl-tail))))
(setq cl-end (1- cl-end)))
(setq cl-p (cdr cl-p) cl-end (1- cl-end)
cl-start (1+ cl-start)))
cl-seq)
(setq cl-end (- (or cl-end (length cl-seq)) cl-start))
(while (and (cdr cl-seq) (= cl-start 0) (> cl-end 1)
(cl--position (cl--check-key (car cl-seq))
(cdr cl-seq) 0 (1- cl-end)))
(setq cl-seq (cdr cl-seq) cl-end (1- cl-end)))
(let ((cl-p (if (> cl-start 0) (nthcdr (1- cl-start) cl-seq)
(setq cl-end (1- cl-end) cl-start 1) cl-seq)))
(while (and (cdr (cdr cl-p)) (> cl-end 1))
(if (cl--position (cl--check-key (car (cdr cl-p)))
(cdr (cdr cl-p)) 0 (1- cl-end))
(progn
(if cl-copy (setq cl-seq (copy-sequence cl-seq)
cl-p (nthcdr (1- cl-start) cl-seq)
cl-copy nil))
(setcdr cl-p (cdr (cdr cl-p))))
(setq cl-p (cdr cl-p)))
(setq cl-end (1- cl-end) cl-start (1+ cl-start)))
cl-seq)))
(let ((cl-res (cl--delete-duplicates (append cl-seq nil) cl-keys nil)))
(if (stringp cl-seq) (concat cl-res) (vconcat cl-res)))))