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

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

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


From: Emanuel Berg
Subject: member returns list (was: Re: To `boundp' or not to `boundp'?)
Date: Wed, 02 Sep 2015 01:37:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Barry Margolin <barmar@alum.mit.edu> writes:

> ... MEMBER, which intuitively seems like it would
> just return a boolean, but actually returns the tail
> of the list where the element was found.

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

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?

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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