From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: wsnyder@wsnyder.org (Wilson Snyder) Newsgroups: gmane.emacs.devel Subject: Re: Suggestions to remove one alist's members from another Date: Fri, 9 Apr 2010 10:16:49 -0400 (EDT) Message-ID: <20100409141649.833BD18838C@wsnyder.org> References: <20100409130204.990F218838C@wsnyder.org> <54158.130.55.118.19.1270822306.squirrel@webmail.lanl.gov> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1270822652 19915 80.91.229.12 (9 Apr 2010 14:17:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Apr 2010 14:17:32 +0000 (UTC) Cc: emacs-devel@gnu.org To: herring@lanl.gov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 09 16:17:30 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O0F1V-0007ox-88 for ged-emacs-devel@m.gmane.org; Fri, 09 Apr 2010 16:17:29 +0200 Original-Received: from localhost ([127.0.0.1]:59737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0F1T-0002wy-OV for ged-emacs-devel@m.gmane.org; Fri, 09 Apr 2010 10:17:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O0F10-0002mU-Uu for emacs-devel@gnu.org; Fri, 09 Apr 2010 10:16:58 -0400 Original-Received: from [140.186.70.92] (port=45747 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O0F0w-0002kn-JM for emacs-devel@gnu.org; Fri, 09 Apr 2010 10:16:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O0F0u-0005kt-8i for emacs-devel@gnu.org; Fri, 09 Apr 2010 10:16:54 -0400 Original-Received: from wsnyder.org ([66.249.9.161]:56948) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O0F0u-0005ke-0e for emacs-devel@gnu.org; Fri, 09 Apr 2010 10:16:52 -0400 Original-Received: from wsnyder.org (c-24-91-159-26.hsd1.ma.comcast.net [24.91.159.26]) by wsnyder.org (Postfix) with ESMTP id 6DC3EE0240; Fri, 9 Apr 2010 14:16:50 +0000 (UTC) Original-Received: by wsnyder.org (Postfix, from userid 1017) id 833BD18838C; Fri, 9 Apr 2010 10:16:49 -0400 (EDT) X-ssh-sendmail: true X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:123392 Archived-At: >> 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