[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: member
From: |
Pascal J. Bourguignon |
Subject: |
Re: member |
Date: |
Thu, 03 Sep 2015 07:19:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Emanuel Berg <embe8573@student.uu.se> writes:
> Barry Margolin <barmar@alum.mit.edu> writes:
>
>> It's no more misleading than MEMBER, which
>> intuitively seems like it would just return
>> a boolean, but actually returns the tail of the list
>> where the element was found.
>
> I guess one can do something like this. But probably
> it will only lead to even more confusion.
>
> (defun memberp (e l)
> (when (member e l) t) )
>
> (memberp 1 '(1 2 3 4)) ; t
> (memberp 0 '(1 2 3 4)) ; nil
If you just want a more concise result, you can use position or find
instead of member. As predicates, they're equivalent.
--
__Pascal Bourguignon__ http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
- Re: member returns list, (continued)
- 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, 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, 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 <=
- Re: member, Emanuel Berg, 2015/09/03
Re: To `boundp' or not to `boundp'?, Stefan Monnier, 2015/09/01