[erlang-questions] Proposed addition to gb_trees
Dan Gudmundsson
dangud@REDACTED
Fri Nov 27 10:29:27 CET 2015
On Fri, Nov 27, 2015 at 6:21 AM Richard A. O'Keefe <ok@REDACTED>
wrote:
<cut gb_trees:updatef impl>
> (1) What's a good name for the function? Update really is
> the right name for it, but the existing 'replace'
> function is called 'update'.
>
Sigh, maybe 'modify' or 'change'.
> (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.
>
IMO it should behave as gb_trees:update/3, dict, orddict and maps does,
i.e. assume the key is present, you can not update something that is not
there.
Add docs and test cases to the pullreq.
And while you are at it the array module need an update/3 as well :-)
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151127/a721ba75/attachment.htm>
More information about the erlang-questions
mailing list