[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX-devel] Call for patches for last release on 11.x series

From: David Kastrup
Subject: Re: [AUCTeX-devel] Call for patches for last release on 11.x series
Date: Sun, 12 Nov 2017 17:57:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

David Kastrup <address@hidden> writes:

>> (defun delete-dups (list)
>>   "Destructively remove `equal' duplicates from LIST.
>> Store the result in LIST and return it.  LIST must be a proper list.
>> Of several `equal' occurrences of an element in LIST, the first
>> one is kept."
>>   (let ((l (length list)))
>>     (if (> l 100)
>>         (let ((hash (make-hash-table :test #'equal :size l))
>>               (tail list) retail)
>>           (puthash (car list) t hash)
>>           (while (setq retail (cdr tail))
>>             (let ((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)))
>>           (setq tail (cdr tail))))))
>>   list)
> I'm pretty sure I created an efficient version of delete-dups (didn't
> use a hash table but rather some algorithm based on sorting) for RefTeX
> at one point of time.  Can we use that?
> Have I committed it?

Ok, so RefTeX is now in the Emacs repo and it neither defines nor uses
anything called akin to delete-dups.  This is serious "Huh?" domain.
Pretty sure I am not dreaming this up.

At any rate: not sure whether XEmacs has the same
make-hash-table/gethash/puthash calls.

David Kastrup

reply via email to

[Prev in Thread] Current Thread [Next in Thread]