[erlang-bugs] Bug in gb_trees ? Integer key not found.

Anthony Ramine nox@REDACTED
Tue May 10 00:26:41 CEST 2011


Le 9 mai 2011 à 23:56, Kostis Sagonas a écrit :

> <aside>
> Note that the two calls might have different semantics actually:
> 
>   1> orddict:from_list([{2,a},{1,b},{2,a},{3,c}]).
>   [{1,b},{2,a},{3,c}]
>   2> lists:sort([{2,a},{1,b},{2,a},{3,c}]).
>   [{1,b},{2,a},{2,a},{3,c}]
> </aside>
> 
> Is this call to lists:sort/1 correct/intentional?  Only the original developer can answer such questions, if he happens to still recall whether this was done just to save a millisecond or for some other reason...  God only knows how many possible subtle bugs may be hidden in such (or similar) code.

lists:ukeysort/2 removes duplicates.

--
Anthony Ramine
Dev:Extend
http://dev-extend.eu







More information about the erlang-bugs mailing list