[erlang-bugs] lists:usort bug 1

Peter Lund erlang@REDACTED
Fri Jun 26 16:06:38 CEST 2009


Looks like an interface change that has taken place somewhere between 
R9C-0 and R12B-3.
Hopefully it is well documented in some release doc... :)

/Peter

Hans Bolinder skrev:
>> Actual behavior:
>>
>> 18> lists:usort(fun(A, B) -> A < B end, [a, a]).
>> [a,a]
>> 19> lists:usort(fun(A, B) -> A =< B end, [a, a]).
>> [a]
>> 20> lists:usort(fun(A, B) -> A >= B end, [a, a]).
>> [a]
>> 21> lists:usort(fun(A, B) -> A > B end, [a, a]).
>> [a,a]
>> 22>
>>
>> Contradicts description "should return true if A comes before B in the 
>> ordering, false otherwise".
>>     
>
> Note that it is assumed by sort/2, usort/2, merge/3, and umerge/3 that
> the fun is an "ordering function". Neither </2 nor >/2 is an ordering
> function.
>
> Best regards,
>
> Hans Bolinder, Erlang/OTP team, Ericsson
>
> ________________________________________________________________
> erlang-bugs mailing list. See http://www.erlang.org/faq.html
> erlang-bugs (at) erlang.org
>
>   



More information about the erlang-bugs mailing list