[erlang-questions] Proposed addition to gb_trees

Pierpaolo Bernardi olopierpa@REDACTED
Fri Nov 27 18:55:35 CET 2015


On Fri, Nov 27, 2015 at 6:14 AM, Richard A. O'Keefe <ok@REDACTED> wrote:

> (2) What should happen if the key is not present in the
>     tree?  gb_trees as its stands has an interface I
>     find complex because practically everything occurs
>     in two or three copies: assume key present, assume key
>     absent, allow for either possibility.  Assuming it's
>     absent doesn't make sense here, because there'd be
>     nothing to pass to Fun.  But that leaves two copies,
>     one which would err if the key was absent and the other
>     which would just not change the tree.

It should take an optional initializer parameter, like for example the
corresponding function in Racket.

http://docs.racket-lang.org/reference/hashtables.html#%28def._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._hash-update%29%29



More information about the erlang-questions mailing list