aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/doc/src
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2016-04-10 23:09:54 +0200
committerBjörn-Egil Dahlberg <[email protected]>2016-04-27 15:26:54 +0200
commitf3c55529dbc9cb3bf8801bea9b64da78b9b73d5a (patch)
treecc278d922716aebea54d43baddc2630c487aa32e /lib/stdlib/doc/src
parent65bd8ade865eebe0d8a3c3210a4e2e9f334e229f (diff)
downloadotp-f3c55529dbc9cb3bf8801bea9b64da78b9b73d5a.tar.gz
otp-f3c55529dbc9cb3bf8801bea9b64da78b9b73d5a.tar.bz2
otp-f3c55529dbc9cb3bf8801bea9b64da78b9b73d5a.zip
stdlib: Document maps:take/2
Diffstat (limited to 'lib/stdlib/doc/src')
-rw-r--r--lib/stdlib/doc/src/maps.xml24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/stdlib/doc/src/maps.xml b/lib/stdlib/doc/src/maps.xml
index 0f58f19421..97a7438890 100644
--- a/lib/stdlib/doc/src/maps.xml
+++ b/lib/stdlib/doc/src/maps.xml
@@ -301,6 +301,30 @@ false</code>
</func>
<func>
+ <name name="take" arity="2"/>
+ <fsummary></fsummary>
+ <desc>
+ <p>
+ The function removes the <c><anno>Key</anno></c>, if it exists, and its associated value from
+ <c><anno>Map1</anno></c> and returns a tuple with the removed <c><anno>Value</anno></c> and
+ the new map <c><anno>Map2</anno></c> without key <c><anno>Key</anno></c>.
+ If the key does not exist <c>error</c> is returned.
+ </p>
+ <p>
+ The call will fail with a <c>{badmap,Map}</c> exception if <c><anno>Map1</anno></c> is not a map.
+ </p>
+ <p>Example:</p>
+ <code type="none">
+> Map = #{"a" => "hello", "b" => "world"}.
+#{"a" => "hello", "b" => "world"}
+> maps:take("a",Map).
+{"hello",#{"b" => "world"}}
+> maps:take("does not exist",Map).
+error</code>
+ </desc>
+ </func>
+
+ <func>
<name name="size" arity="1"/>
<fsummary></fsummary>
<desc>