emacs-devel
[Top][All Lists]
Advanced

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

Re: Suggestions to remove one alist's members from another


From: Wilson Snyder
Subject: Re: Suggestions to remove one alist's members from another
Date: Fri, 9 Apr 2010 10:16:49 -0400 (EDT)

>> If not, my thought is this: when the list was over some size
>> I'd determine experimentally, it would instead build a hash
>> table from in-list and hit the not-alist against that.  When
>> complete it would unfortunately require a second pass
>> through the in-alist to return it maintaining the original
>> order.
>
>Why not build a hash table (of the cars of the elements) from not-alist
>instead?  Then you can just walk in-alist, skipping elements that are in
>the hash (that is, whose cars are in it) and adding the rest to out-alist
>and (their cars to) the hash.

Thanks, that's a good improvement. I also would add each
in-list element after each test for hash membership, as I
want to eliminate duplicates.

It still seems like this should already exist somewhere...

-Wilson




reply via email to

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