diff options
author | Björn Gustavsson <[email protected]> | 2016-12-16 12:50:28 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-12-19 11:54:06 +0100 |
commit | a2d92dff3a8acc534daeeb3dea5edda406a6ab0d (patch) | |
tree | a61765af69f9cca94879083422571be3c959bd8c /lib/stdlib/doc/src/gb_trees.xml | |
parent | 8362491325db87bd7d561399f8ef8c849df22d33 (diff) | |
download | otp-a2d92dff3a8acc534daeeb3dea5edda406a6ab0d.tar.gz otp-a2d92dff3a8acc534daeeb3dea5edda406a6ab0d.tar.bz2 otp-a2d92dff3a8acc534daeeb3dea5edda406a6ab0d.zip |
Add take/2 to all dictionary modules
Similar to maps:take/2, add take/2 to the other dictionary
modules in STDLIB:
orddict:take(Key, Dict) -> {Val,NewDict} | 'error'.
dict:take(Key, Dict) -> {Val,NewDict} | 'error'.
gb_trees:take(Key, Dict) -> {Val,NewDict}.
For gb_trees also add:
gb_trees:take_any(Key, Dict) -> {Val,NewDict} | 'error'.
gb_trees already has delete() and delete_any(), so we will
follow that design pattern.
Suggested by Boris Bochkaryov in https://github.com/erlang/otp/pull/1209.
Diffstat (limited to 'lib/stdlib/doc/src/gb_trees.xml')
-rw-r--r-- | lib/stdlib/doc/src/gb_trees.xml | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/stdlib/doc/src/gb_trees.xml b/lib/stdlib/doc/src/gb_trees.xml index 790d4b8bf1..5cfff021c1 100644 --- a/lib/stdlib/doc/src/gb_trees.xml +++ b/lib/stdlib/doc/src/gb_trees.xml @@ -109,6 +109,28 @@ </func> <func> + <name name="take" arity="2"/> + <fsummary>Returns a value and new tree without node with key <c>Key</c>.</fsummary> + <desc> + <p>Returns a value <c><anno>Value</anno></c> from node with key <c><anno>Key</anno></c> + and new <c><anno>Tree2</anno></c> without the node with this value. + Assumes that the node with key is present in the tree, + crashes otherwise.</p> + </desc> + </func> + + <func> + <name name="take_any" arity="2"/> + <fsummary>Returns a value and new tree without node with key <c>Key</c>.</fsummary> + <desc> + <p>Returns a value <c><anno>Value</anno></c> from node with key <c><anno>Key</anno></c> + and new <c><anno>Tree2</anno></c> without the node with this value. + Returns <c>error</c> if the node with the key is not present in + the tree.</p> + </desc> + </func> + + <func> <name name="empty" arity="0"/> <fsummary>Return an empty tree.</fsummary> <desc> |