[erlang-bugs] Bug in gb_trees ? Integer key not found.
PAILLEAU Eric
eric.pailleau@REDACTED
Wed May 11 19:26:27 CEST 2011
Le 11/05/2011 03:42, Robert Virding a écrit :
> Wouldn't the easiest and cleanest solution to this problem be just add gb_trees:from_list? I have no idea why there isn't one.
>
> I don't know if orddict could be an opaque type as the point of it is that the representation is defined to be an ordered list.
>
> Robert
>
hello,
I didn't figure out that my "newbie mistake" will generate all these
answers.
The puzzling thing in my mistake is that the function looks to return a
valid balanced tree, even if lookup doesn't work properly...
As 'ordered list' is not a type, input is not tested and no exception is
raised. I do understand.
I agree with Robert : a gb_trees:from_list would be necessary because it
is unlikely to have ordered list from scratch in real life.
It is probable that any call to the function uses 'sort' in the line
above or directly in the input, like do the beam compiler
:gb_trees:from_orddict(lists:sort(L)) . So the overhead is either done
in the module code or in the user code anyway ...
In addition to this, there is 'from_list' functions in queue, ordsets,
array, orddict, dict, sets and gb_sets modules, but not in gb_trees ...
Why not :>) ?
Regards.
More information about the erlang-bugs
mailing list