[erlang-questions] Proposed addition to gb_trees

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Fri Nov 27 13:52:22 CET 2015


On Fri, Nov 27, 2015 at 10:29 AM, Dan Gudmundsson <dangud@REDACTED> wrote:

> 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.
>

The alternative is a function of the form (undefined | {value, Key, Value})
-> undefined | {ok, Value} | {error, Reason}. This allows the function to
decide and in particular implement "upsert"-like functionality. This is not
too far-fetched: OCaml's Core library calls the updater 'change' in this
case.


-- 
J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151127/e9c4c8f9/attachment.htm>


More information about the erlang-questions mailing list