From: Paul Reiners on
In the following Lisp REPL interaction:

CL-USER> (defparameter *unison* 0)
*UNISON*
CL-USER> (member *unison* '(*unison*))
NIL

why is nil returned?
From: Zach Beane on
Paul Reiners <paul.reiners(a)gmail.com> writes:

> In the following Lisp REPL interaction:
>
> CL-USER> (defparameter *unison* 0)
> *UNISON*
> CL-USER> (member *unison* '(*unison*))
> NIL
>
> why is nil returned?

The two values you have passed to MEMBER are 0 and a list with one
element, the symbol *UNISON*. Since 0 is not the symbol *UNISON*, it is
not a member of the list.

If you wanted to pass a list with one element, 0, you could do this:

(member *unison* (list *unison*)) => t

Zach
From: Joshua Taylor on
On 2010.05.26 7:56 PM, Paul Reiners wrote:
> In the following Lisp REPL interaction:
>
> CL-USER> (defparameter *unison* 0)
> *UNISON*
> CL-USER> (member *unison* '(*unison*))
> NIL
>
> why is nil returned?

0 isn't a member of the list containing just the symbol named
"*UNISON*". Your code above is similar to:

CL-USER > (member '*unison* '(*unison*))
(*UNISON*)

But you should also compare with:

CL-USER 19 > (member *unison* '(*unison*))
NIL

CL-USER 20 > (member *unison* (list *unison*))
(0)

CL-USER 22 > (member '*unison* (list *unison*))
NIL

CL-USER 23 > (member '*unison* (list '*unison*))
(*UNISON*)
From: Joshua Taylor on
On 2010.05.26 8:04 PM, Joshua Taylor wrote:
> On 2010.05.26 7:56 PM, Paul Reiners wrote:
>> In the following Lisp REPL interaction:
>>
>> CL-USER> (defparameter *unison* 0)
>> *UNISON*
>> CL-USER> (member *unison* '(*unison*))
>> NIL
>>
>> why is nil returned?
>
> 0 isn't a member of the list containing just the symbol named
> "*UNISON*". Your code above is similar to:
>
> CL-USER > (member '*unison* '(*unison*))
> (*UNISON*)

Well that was a typo---the original code is similar to:

CL-USER > (member *unison* (list '*unison*))
NIL

or

CL-USER > (member 0 (list '*unison*))
NIL
From: Andrew Philpot on
On 05/26/10 16:56, Paul Reiners wrote:
> In the following Lisp REPL interaction:
>
> CL-USER> (defparameter *unison* 0)
> *UNISON*
> CL-USER> (member *unison* '(*unison*))
> NIL
>
> why is nil returned?

Did you mean

(member '*unison* '(*unison*)) ;; symbol

or perhaps

(member *unison* (list *unison*)) ;; value

A