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: Stephen J. Turnbull
Subject: Re: Suggestions to remove one alist's members from another
Date: Sat, 10 Apr 2010 02:31:02 +0900

Wilson Snyder writes:

 > >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.

Note that Davis's algorithm already does this, IIUC.  Elements that
are just skipped don't need to be added because they are in the hash
already, while elements that are added to the out-alist get added to
the hash, too.

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

The Common Lisp emulation has such operations, but I think they're not
stable.




reply via email to

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