diff options
| -rw-r--r-- | lisp/subr.el | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 641d81a6fb6..0b3c3df4e8d 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -210,18 +210,14 @@ If N is bigger than the length of X, return X." | |||
| 210 | x)))) | 210 | x)))) |
| 211 | 211 | ||
| 212 | (defun delete-dups (list) | 212 | (defun delete-dups (list) |
| 213 | "Destructively return LIST, with `equal' duplicates removed. | 213 | "Destructively remove `equal' duplicates from LIST. |
| 214 | LIST must be a proper list. The value of LIST after a call to | 214 | Store the result in LIST and return it. LIST must be a proper list. |
| 215 | this function is undefined. Use \(setq LIST (delete-dups LIST)) | 215 | Of several `equal' occurrences of an element in LIST, the first |
| 216 | if you want to store the return value in LIST. Of several | 216 | one is kept." |
| 217 | `equal' occurrences of an element in LIST, the last one is kept." | ||
| 218 | (while (member (car list) (cdr list)) | ||
| 219 | (pop list)) | ||
| 220 | (let ((tail list)) | 217 | (let ((tail list)) |
| 221 | (while tail | 218 | (while tail |
| 222 | (while (member (cadr tail) (cddr tail)) | 219 | (setcdr tail (delete (car tail) (cdr tail))) |
| 223 | (setcdr tail (cddr tail))) | 220 | (setq tail (cdr tail)))) |
| 224 | (pop tail))) | ||
| 225 | list) | 221 | list) |
| 226 | 222 | ||
| 227 | (defun number-sequence (from &optional to inc) | 223 | (defun number-sequence (from &optional to inc) |