From: Jack Tanner
Subject: lists of strings
Date: 
Message-ID: <bp17j7$t79$1@usenet01.srv.cis.pitt.edu>
Why does this work...

(member 'a '(a b c))
(A B C)

... but not this?

(member '"A" '("A" "B" "C"))
NIL

Should I be using read-from-string when I construct my list?

Thanks,
JT

From: Howard Ding <······@hading.dnsalias.com>
Subject: Re: lists of strings
Date: 
Message-ID: <m3n0azzsvm.fsf@frisell.localdomain>
Jack Tanner <····@hotmail.com> writes:

> Why does this work...
>
> (member 'a '(a b c))
> (A B C)
>
> ... but not this?
>
> (member '"A" '("A" "B" "C"))
> NIL
>
> Should I be using read-from-string when I construct my list?

In the latter case, you probably mean something like:

(member '"A" '("A" "B" "C") :test #'string=)

You want to check up on what the default equality test for member is
and how it interacts with strings.

-- 
Howard Ding
<······@hading.dnsalias.com>
From: Lowell
Subject: Re: lists of strings
Date: 
Message-ID: <bp20b1$q6g$1@mughi.cs.ubc.ca>
Also, you don't need to quote (that is, single quote) "A". What you 
should have is :
(member "A" '("A" "B" "C") :test #'string=)

Lowell

Howard Ding wrote:
> Jack Tanner <····@hotmail.com> writes:
> 
> 
>>Why does this work...
>>
>>(member 'a '(a b c))
>>(A B C)
>>
>>... but not this?
>>
>>(member '"A" '("A" "B" "C"))
>>NIL
>>
>>Should I be using read-from-string when I construct my list?
> 
> 
> In the latter case, you probably mean something like:
> 
> (member '"A" '("A" "B" "C") :test #'string=)
> 
> You want to check up on what the default equality test for member is
> and how it interacts with strings.
> 
From: Marco Antoniotti
Subject: Re: lists of strings
Date: 
Message-ID: <nW5ub.214$KR3.107659@typhoon.nyu.edu>
Jack Tanner wrote:

> Why does this work...
> 
> (member 'a '(a b c))
> (A B C)
> 
> ... but not this?
> 
> (member '"A" '("A" "B" "C"))
> NIL

It is a RTFM question. :)  MEMBER uses #'EQL as a test function by default.
Now

cl-prompt> (eql "foo" "foo")
NIL

However

cl-prompt> (string= "foo" "foo")
T

Therefore

cl-prompt> (member "A" '("A" "B" "C") :test #'string=)
("A" "B" "C")

Your orignal call using symbols is really

cl-prompt> (member 'A '(A B C) :test #'eql) ; Where the :TEST argument
                                             ; is defaulted.



> 
> Should I be using read-from-string when I construct my list?

Only if you need to.

Cheers
--
Marco