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

[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


reply via email to

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