[erlang-questions] gb_trees missing function!?

Richard Carlsson carlsson.richard@REDACTED
Thu May 31 09:00:39 CEST 2012


On 05/25/2012 09:30 PM, Dmitry Kolesnikov wrote:
> Hello,
>
> gb_trees  is pretty efficient in many use cases but I am starting to miss couple of features:
>   * range(From, To, Tree) ->  [{Key, Val}] to retrieve multiple keys
>   * iterator(Key, Tree) ->  Iter start iterator from Key
>
> of course lists:dropwhile(fun(X) ->  X<  Key end, gb_trees:to_list(Tree)) makes trick but I think it is not very efficient...
>
> What is your opinion?

I think these are good ideas. If you mail me a suggested patch, I can 
try to get them into OTP. A while back I posted to the list that I've 
been working on a unified API for dict-like modules, and I think that at 
least the range function should probably be a standard function in that 
API (possibly under another name).

    /Richard



More information about the erlang-questions mailing list