diff options
| author | Oleh Krehel | 2015-05-06 21:30:54 +0200 |
|---|---|---|
| committer | Oleh Krehel | 2015-05-06 21:30:54 +0200 |
| commit | 1ca93e01841975dab67fbc0f4cb92aff94a654d7 (patch) | |
| tree | d5feb109e263b3131894737339cb50c7ff5c7244 | |
| parent | f201bf6a5050d575dfc759fa23955fab0fbcfcb9 (diff) | |
| download | emacs-1ca93e01841975dab67fbc0f4cb92aff94a654d7.tar.gz emacs-1ca93e01841975dab67fbc0f4cb92aff94a654d7.zip | |
lisp/subr.el (delete-dups): Avoid nreverse.
| -rw-r--r-- | lisp/subr.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index a32fb968365..ce9b44c6ef9 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -419,12 +419,15 @@ Of several `equal' occurrences of an element in LIST, the first | |||
| 419 | one is kept." | 419 | one is kept." |
| 420 | (if (> (length list) 100) | 420 | (if (> (length list) 100) |
| 421 | (let ((hash (make-hash-table :test #'equal)) | 421 | (let ((hash (make-hash-table :test #'equal)) |
| 422 | res) | 422 | (tail list) |
| 423 | (dolist (elt list) | 423 | elt retail) |
| 424 | (unless (gethash elt hash) | 424 | (puthash (car list) t hash) |
| 425 | (puthash elt elt hash) | 425 | (while (setq retail (cdr tail)) |
| 426 | (push elt res))) | 426 | (setq elt (car retail)) |
| 427 | (setcdr list (cdr (nreverse res)))) | 427 | (if (gethash elt hash) |
| 428 | (setcdr tail (cdr retail)) | ||
| 429 | (puthash elt t hash)) | ||
| 430 | (setq tail retail))) | ||
| 428 | (let ((tail list)) | 431 | (let ((tail list)) |
| 429 | (while tail | 432 | (while tail |
| 430 | (setcdr tail (delete (car tail) (cdr tail))) | 433 | (setcdr tail (delete (car tail) (cdr tail))) |