From eeac08ca0ed6358a87f265f87a62bea8d0feb3b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Sat, 23 Apr 2016 00:17:04 +0200 Subject: stdlib: Document maps:update_with/3,4 --- lib/stdlib/doc/src/maps.xml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/maps.xml b/lib/stdlib/doc/src/maps.xml index 97a7438890..bf45461e2b 100644 --- a/lib/stdlib/doc/src/maps.xml +++ b/lib/stdlib/doc/src/maps.xml @@ -381,6 +381,42 @@ error + + + + +

Update a value in a Map1 associated with Key by + calling Fun on the old value to get a new value. An exception + {badkey,Key} is generated if + Key is not present in the map.

+

Example:

+ +> Map = #{"counter" => 1}, + Fun = fun(V) -> V + 1 end, + maps:update_with("counter",Fun,Map). +#{"counter" => 2} +
+
+ + + + + +

Update a value in a Map1 associated with Key by + calling Fun on the old value to get a new value. + If Key is not present + in Map1 then Init will be associated with + Key. +

+

Example:

+ +> Map = #{"counter" => 1}, + Fun = fun(V) -> V + 1 end, + maps:update_with("new counter",Fun,42,Map). +#{"counter" => 1,"new counter" => 42} +
+
+ -- cgit v1.2.3