lisp/subr.el (delete-dups): Avoid nreverse.
This commit is contained in:
parent
f201bf6a50
commit
1ca93e0184
1 changed files with 9 additions and 6 deletions
15
lisp/subr.el
15
lisp/subr.el
|
@ -419,12 +419,15 @@ Of several `equal' occurrences of an element in LIST, the first
|
|||
one is kept."
|
||||
(if (> (length list) 100)
|
||||
(let ((hash (make-hash-table :test #'equal))
|
||||
res)
|
||||
(dolist (elt list)
|
||||
(unless (gethash elt hash)
|
||||
(puthash elt elt hash)
|
||||
(push elt res)))
|
||||
(setcdr list (cdr (nreverse res))))
|
||||
(tail list)
|
||||
elt retail)
|
||||
(puthash (car list) t hash)
|
||||
(while (setq retail (cdr tail))
|
||||
(setq elt (car retail))
|
||||
(if (gethash elt hash)
|
||||
(setcdr tail (cdr retail))
|
||||
(puthash elt t hash))
|
||||
(setq tail retail)))
|
||||
(let ((tail list))
|
||||
(while tail
|
||||
(setcdr tail (delete (car tail) (cdr tail)))
|
||||
|
|
Loading…
Add table
Reference in a new issue