summaryrefslogtreecommitdiff
path: root/lib/stdlib/doc/src/maps.xml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stdlib/doc/src/maps.xml')
-rw-r--r--lib/stdlib/doc/src/maps.xml51
1 files changed, 45 insertions, 6 deletions
diff --git a/lib/stdlib/doc/src/maps.xml b/lib/stdlib/doc/src/maps.xml
index ea0f16eec9..203eeccaf3 100644
--- a/lib/stdlib/doc/src/maps.xml
+++ b/lib/stdlib/doc/src/maps.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>2013</year><year>2021</year>
+ <year>2013</year><year>2023</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -43,10 +43,15 @@
<p>An iterator representing the associations in a map with keys of type
<c><anno>Key</anno></c> and values of type <c><anno>Value</anno></c>.</p>
<p>Created using <seemfa marker="#iterator/1"><c>maps:iterator/1</c></seemfa>.</p>
- <p>Consumed by <seemfa marker="#next/1"><c>maps:next/1</c></seemfa>,
- <seemfa marker="#filter/2"><c>maps:filter/2</c></seemfa>,
- <seemfa marker="#fold/3"><c>maps:fold/3</c></seemfa> and
- <seemfa marker="#map/2"><c>maps:map/2</c></seemfa>.</p>
+ <p>Consumed by:</p>
+ <list type="bulleted">
+ <item><seemfa marker="#next/1"><c>maps:next/1</c></seemfa></item>
+ <item><seemfa marker="#filter/2"><c>maps:filter/2</c></seemfa></item>
+ <item><seemfa marker="#filtermap/2"><c>maps:filtermap/2</c></seemfa></item>
+ <item><seemfa marker="#fold/3"><c>maps:fold/3</c></seemfa></item>
+ <item><seemfa marker="#foreach/2"><c>maps:foreach/2</c></seemfa></item>
+ <item><seemfa marker="#map/2"><c>maps:map/2</c></seemfa></item>
+ </list>
</desc>
</datatype>
@@ -231,6 +236,39 @@ val1
</func>
<func>
+ <name name="groups_from_list" arity="2" since="OTP 25.0"/>
+ <fsummary>Splits the list into groups using a function as discriminator.</fsummary>
+ <desc>
+ <p>The result is a map where each key is given by <anno>Fun</anno>
+ and each value is a list of elements. The order of elements within
+ each list is preserved from the list.</p>
+ <p><em>Examples:</em></p>
+ <pre>
+> <input>maps:groups_from_list(fun(X) -> X rem 2 end, [1,2,3]).</input>
+#{0 => [2], 1 => [1, 3]}
+> <input>maps:groups_from_list(fun erlang:length/1, ["ant", "buffalo", "cat", "dingo"]).</input>
+#{3 => ["ant", "cat"], 5 => ["dingo"], 7 => ["buffalo"]}</pre>
+ </desc>
+ </func>
+
+ <func>
+ <name name="groups_from_list" arity="3" since="OTP 25.0"/>
+ <fsummary>Splits the list into groups using a function as discriminator.</fsummary>
+ <desc>
+ <p>The result is a map where each key is given by
+ <anno>Fun</anno> and each value is a list of elements given by
+ the <anno>ValueFun</anno>. The order of elements within each
+ list is preserved from the list.</p>
+ <p><em>Examples:</em></p>
+ <pre>
+> <input>maps:groups_from_list(fun(X) -> X rem 2 end, fun(X) -> X*X end, [1,2,3]).</input>
+#{0 => [4], 1 => [1, 9]}
+> <input>maps:groups_from_list(fun erlang:length/1, fun lists:reverse/1, ["ant", "buffalo", "cat", "dingo"]).</input>
+#{3 => ["tna","tac"],5 => ["ognid"],7 => ["olaffub"]}</pre>
+ </desc>
+ </func>
+
+ <func>
<name name="intersect" arity="2" since="OTP 24.0"/>
<fsummary></fsummary>
<desc>
@@ -606,7 +644,7 @@ error</code>
maps:update_with("new counter",Fun,42,Map).
#{"counter" => 1,"new counter" => 42}</code>
</desc>
- </func>
+ </func>
<func>
<name name="values" arity="1" since="OTP 17.0"/>
@@ -657,5 +695,6 @@ error</code>
#{1337 => "value two"}</code>
</desc>
</func>
+
</funcs>
</erlref>