keysort + removing duplicate keys

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Wed Mar 1 10:37:18 CET 2006

At least I found this slightly surprising:

2> lists:ukeysort(1,[{1,a},{1,b}]).
3> lists:ukeysort(1,[{1,a},{1,a}]).

The man page says that lists:ukeysort/2 removes
consecutive duplicates. I just assumed that it meant
_duplicate keys_, but apparently not. Perhaps the 
manual could emphasize this point, for the sake of 
dunces like me?

I went on to orddict:


(That is, I have a list with proplist semantics, and want to produce a
list of values sorted by the lexical order of the keys.)

orddict:from_list(L) seems to do what I want, but the man page doesn't
mention how orddict goes about treating consecutive duplicates. Wouldn't
this sort information be useful?

/Ulf W

More information about the erlang-questions mailing list