[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What to do for faster `remove-duplicates'?
From: |
Artur Malabarba |
Subject: |
Re: What to do for faster `remove-duplicates'? |
Date: |
Wed, 6 May 2015 22:18:14 +0100 |
On May 6, 2015 9:54 PM, "Stefan Monnier" <address@hidden> wrote:
>
> >>> Looks good, please install.
> >> Not so good as now it is no more destructive for a seq > 100.
>
> Not being destructive doesn't seem like a serious problem to me.
Usually, yes. But here the docstring specifically documents that "Destructively remove `equal' duplicates from LIST.
Store the result in LIST and return it."
>
> > modified lisp/subr.el
> > @@ -424,12 +424,12 @@ one is kept."
> > (unless (gethash elt hash)
> > (puthash elt elt hash)
> > (push elt res)))
> > - (nreverse res))
> > + (setcdr list (cdr (nreverse res))))
>
> I don't understand what this is intended to do.
It destructively modifies list to be equal to (nreverse res). The car is already the same, so only the cdr needs to be modified.
- Re: What to do for faster `remove-duplicates'?, (continued)
- Re: What to do for faster `remove-duplicates'?, Oleh Krehel, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Artur Malabarba, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Artur Malabarba, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Oleh Krehel, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Artur Malabarba, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Oleh Krehel, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Artur Malabarba, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Thierry Volpiatto, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Stefan Monnier, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Stefan Monnier, 2015/05/06
- Re: What to do for faster `remove-duplicates'?,
Artur Malabarba <=
- Re: What to do for faster `remove-duplicates'?, Artur Malabarba, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Oleh Krehel, 2015/05/06
- Re: What to do for faster `remove-duplicates'?, Artur Malabarba, 2015/05/06