help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: member returns list (was: Re: To `boundp' or not to `boundp'?)


From: Drew Adams
Subject: RE: member returns list (was: Re: To `boundp' or not to `boundp'?)
Date: Tue, 1 Sep 2015 17:10:56 -0700 (PDT)

> Yes, and I have wondered about that. Is it useful,
> perhaps with the use of `car' (?) as in:
>     (car (member 2 '(1 2 3))) ; 2
>     (car (member 0 '(1 2 3))) ; nil

Yes, extremely useful.

> Or is it some "leftover optimization" thing where
> `cdr' is faster than returning `t', and can be used
> the same way?  Or is it something else?

No and no.

It's an access function, like `assoc' or `elt'.
If no such member can be found then it returns nil,
which means that it can also function as a simple
membership test.



reply via email to

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