[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: |
Barry Margolin |
Subject: |
Re: member returns list (was: Re: To `boundp' or not to `boundp'?) |
Date: |
Wed, 02 Sep 2015 12:25:39 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <mailman.363.1441150201.19560.help-gnu-emacs@gnu.org>,
Emanuel Berg <embe8573@student.uu.se> wrote:
> 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?
It could be useful for something like
(length (member item list))
Or it could be used in a loop, where you repeat the operation with the
list that it returned.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
- Re: member returns list, (continued)
- Re: member returns list, Eli Zaretskii, 2015/09/12
- Message not available
- Re: member returns list, Pascal J. Bourguignon, 2015/09/10
- Re: member returns list, Emanuel Berg, 2015/09/11
- RE: member returns list, Drew Adams, 2015/09/06
- RE: member returns list, Drew Adams, 2015/09/06
- Message not available
- Re: member returns list, Barry Margolin, 2015/09/04
- Re: member returns list, Emanuel Berg, 2015/09/05
- member (was: Re: To `boundp' or not to `boundp'?), Emanuel Berg, 2015/09/01
- Message not available
- Re: member returns list (was: Re: To `boundp' or not to `boundp'?),
Barry Margolin <=
- Re: member returns list (was: Re: To `boundp' or not to `boundp'?), Emanuel Berg, 2015/09/02
- Message not available
- Re: member returns list (was: Re: To `boundp' or not to `boundp'?), Barry Margolin, 2015/09/02
- Re: member returns list (was: Re: To `boundp' or not to `boundp'?), Emanuel Berg, 2015/09/02
- Message not available
- Re: member, Pascal J. Bourguignon, 2015/09/03
- Re: member, Emanuel Berg, 2015/09/03
Re: To `boundp' or not to `boundp'?, Stefan Monnier, 2015/09/01