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

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

bug#40972: 27.0.91; assoc TESTFN's args reversed?


From: Stefan Kangas
Subject: bug#40972: 27.0.91; assoc TESTFN's args reversed?
Date: Wed, 9 Sep 2020 06:22:18 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

tags 40972 + wontfix notabug
close 40972
thanks

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Shigeru Fukaya <shigeru.fukaya@gmail.com> writes:
>
>> It seems to me, for third argument of `assoc', arguments are passed in a
>> reverse order.
>>
>> (assoc "assoc" '(("cl-assoc" A) ("cl-member" B))
>>        (lambda (x y) (equal (concat "cl-" x) y)))
>> ==> nil
>>
>> (assoc "assoc" '(("cl-assoc" A) ("cl-member" B))
>>        (lambda (y x) (equal (concat "cl-" x) y)))
>> ==> ("cl-assoc" A)
>>
>> Or, is this intended behavior??
>
> Dunno what others expect, but note that your predicate is not an
> equality predicate (it's not symmetric), and the docstring doesn't
> specify a behavior for this case.

As Michael points out, the equality operation is symmetric and therefore
by definition the order does not matter.  We therefore cannot say if X=Y
or Y=X is "more correct": they are equivalent.

In any case, I think it will cause more problems to switch the argument
order at this point, since there might be code out there that relies on
this (undocumented) behavior.  So I'm closing this bug.





reply via email to

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