From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Help with elisp Date: Thu, 31 Jul 2003 09:59:58 -0600 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <3F293CFE.2080809@yahoo.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1059667911 5876 80.91.224.249 (31 Jul 2003 16:11:51 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 31 Jul 2003 16:11:51 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 31 18:11:49 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19iFym-0001Bv-00 for ; Thu, 31 Jul 2003 18:08:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19iFs2-00029W-2U for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Jul 2003 12:01:38 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!nycmny1-snf1.gtei.net!news.gtei.net!colt.net!peernews3.colt.net!news0.de.colt.net!newsfeed.r-kom.de!fu-berlin.de!uni-berlin.de!170.207.51.80!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: 170.207.51.80 Original-X-Trace: news.uni-berlin.de 1059667190 24219693 170.207.51.80 (16 [82742]) User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us Original-Xref: shelby.stanford.edu gnu.emacs.help:115588 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11506 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11506 Tom Capey wrote: > * David Chadd writes: >>Having found the string of values (CAO-C Alb2 Hyd) with a regexp >>search, I simple-mindedly thought I would be able to do something like >> >> (setq wits (split-string (match-string 1))) >> >>This does indeed make a list --- (listp wits) returns T --- but the >>lists don't behave as I would expect. For instance, they don't >>respond correctly to (set-difference), (intersection) etc. And for >>reasons I can guess at, but don't know enough to do anything about, >>the lists are in the form ("CAO-C" "Alb2" "Hyd") rather than (CAO-C >>Alb2 Hyd). > > change the test in the set functions from `eq': > > (setq a (list "CAO-C" "Alb2" "Hyd") > b (list "CAO-C" "Alb2" "Hyd" "foo")) > > (intersection a b :test 'string-equal) > => ("Hyd" "Alb2" "CAO-C") > > (set-difference b a :test 'string-equal) > => ("foo") > > (set-difference a b :test 'string-equal) > => nil Or create a list of symbols (which can be compared with `eq') instead of strings (which can't): (setq wits (mapcar 'intern (split-string (match-string 1)))) -- Kevin Rodgers