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

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

Re: member returns list


From: Pascal J. Bourguignon
Subject: Re: member returns list
Date: Sun, 06 Sep 2015 01:39:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Random832 <random832@fastmail.com> writes:

> Emanuel Berg <embe8573@student.uu.se> writes:
>
>> If we stick to `member' (using `equal') vs. `memq'
>> (using `eq'), this renaming of those:
>>
>>     member-equal
>>     member-eq
>>
>> would be seen by some people as more consistent than
>> the actual
>>
>>     member
>>     memq
>
> Why not simply eliminate both and have something like
> (member-test #'eq object list)
>
> Or
> (member-if (lambda (x) (eq object x)) list)?

There were a lot of variants and propositions, amongst all the lisp
dialects.  Then starting from 1984, some interested corporations and
institutes invested a lot of money (in form of salaries to detached
employees), to form a standardization commitee and decide on this all
all similar kinds of discrepancies that made porting lisp programs from
one lisp to the other a PITA. They worked hard, for ten years.  Then
money was exhausted, so they finalized an ANSI Common Lisp standard in
1994.

Therefore nowadays, you write:

  (member element list :test (function eql))
  (member element list :test (function equal))
  (member element list :test (function equalp))
  (member element list :test (function your-own-equivalence-relationship))

or member* in emacs lisp since RMS doesn't want to rejoin the common
community of lispers…

-- 
__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]