[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 18:56:45 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <mailman.426.1441229773.19560.help-gnu-emacs@gnu.org>,
Emanuel Berg <embe8573@student.uu.se> wrote:
> Barry Margolin <barmar@alum.mit.edu> writes:
>
> > 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.
>
> Yes, I understand it can be used in many situations.
> The sky is the limit. What I thought, I thought it was
> either an "inverted optimization" (i.e., the
> optimization is not to make it intuitive but leave it
> as it is which is faster and works the same) *or* if
> there was one (1), or but a few cases where it is very
> useful, simple combinations like the 1-2 of boxing or
> one-timer in ice hockey, that would be interesting
> to see.
>
> We can compare it to something else and you will
> understand immediately what I mean: `or' is
> intuitively a boolean, but in practice it is a boolean
> AND the item which was first found to be true,
> returned. I.e., it is just like `member' in that
> sense. However, with `or' if anyone asked the question
> I asked about `member', I would answer without
> blinking, because then you can do
>
> (or title "The boring standard title that should never appear")
>
> The examples provided hasn't been as straightforward
> as that, at least not to me, but it is OK. They don't
> have to be.
The basic idea of all these things is that if a function can easily
return something more detailed and potentially useful than just
true/false, it might as well do so. There's no downside, and potential
upside.
--
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, 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, 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 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, 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