aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorMarcus Arendt <[email protected]>2014-08-26 16:24:11 +0200
committerMarcus Arendt <[email protected]>2014-08-26 16:24:11 +0200
commit84716a6075614e5b776b9b0357f7c2e5d897d168 (patch)
treeb09b11b7e1ef2b6387d740a94715f4995f8a91a6 /lib/stdlib
parenta75f44aafa24d38d9ab3036d2059ce0915069105 (diff)
parent3703b8964991fee50ea36f71fba115c6abc10e0b (diff)
downloadotp-84716a6075614e5b776b9b0357f7c2e5d897d168.tar.gz
otp-84716a6075614e5b776b9b0357f7c2e5d897d168.tar.bz2
otp-84716a6075614e5b776b9b0357f7c2e5d897d168.zip
Merge branch 'maint'
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/maps.erl11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/stdlib/src/maps.erl b/lib/stdlib/src/maps.erl
index 3f019aa35a..ba4d6a5c87 100644
--- a/lib/stdlib/src/maps.erl
+++ b/lib/stdlib/src/maps.erl
@@ -24,6 +24,7 @@
map/2,
size/1,
without/2,
+ with/2,
get/3
]).
@@ -201,3 +202,13 @@ size(Map) when is_map(Map) ->
without(Ks, M) when is_list(Ks), is_map(M) ->
maps:from_list([{K,V}||{K,V} <- maps:to_list(M), not lists:member(K, Ks)]).
+
+
+-spec with(Ks, Map1) -> Map2 when
+ Ks :: [K],
+ Map1 :: map(),
+ Map2 :: map(),
+ K :: term().
+
+with(Ks, M) when is_list(Ks), is_map(M) ->
+ maps:from_list([{K,V}||{K,V} <- maps:to_list(M), lists:member(K, Ks)]).