[erlang-bugs] Possible documentation error?
Hans Bolinder
hans.bolinder@REDACTED
Wed Aug 19 11:06:16 CEST 2009
[John Haugeland:]
> >From the lists module documentation for ukeysort/2:
>
> "Returns a list containing the sorted elements of the list TupleList1 where
> all but the first tuple of the tuples comparing equal have been deleted."
>
> Actual behavior is to make unique on key equality, not on tuple equality.
>
> 243> lists:ukeysort(2, [ {1,1}, {2,1}, {2,2} ]).
> [{1,1},{2,2}]
>
> Am I missing something obvious?
I don't know, perhaps the wording is unclear. But you left out the
last sentence of the documentation:
"Sorting is performed on the Nth element of the tuples."
which means that two tuples compare equal if the Nth element of the
tuples compare equal.
Best regards,
Hans Bolinder, Erlang/OTP team, Ericsson
More information about the erlang-bugs
mailing list