aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2013-10-24 19:06:34 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-01-28 17:06:42 +0100
commit6fdad74f41803089a0f9026c98f319daecda9a50 (patch)
treea62dd33f1bc4ee7e2ada65135919b599c11d9be9 /lib/stdlib
parentf8345dc86a1787c3c8deb06befbb697f37db1c0b (diff)
downloadotp-6fdad74f41803089a0f9026c98f319daecda9a50.tar.gz
otp-6fdad74f41803089a0f9026c98f319daecda9a50.tar.bz2
otp-6fdad74f41803089a0f9026c98f319daecda9a50.zip
erts,stdlib: Change map module name to maps
Name conforms to EEP.
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/Makefile2
-rw-r--r--lib/stdlib/src/erl_eval.erl10
-rw-r--r--lib/stdlib/src/erl_parse.yrl2
-rw-r--r--lib/stdlib/src/io_lib.erl2
-rw-r--r--lib/stdlib/src/maps.erl (renamed from lib/stdlib/src/map.erl)39
-rw-r--r--lib/stdlib/src/stdlib.app.src2
6 files changed, 28 insertions, 29 deletions
diff --git a/lib/stdlib/src/Makefile b/lib/stdlib/src/Makefile
index 376083c7d6..9ab2cd4134 100644
--- a/lib/stdlib/src/Makefile
+++ b/lib/stdlib/src/Makefile
@@ -91,7 +91,7 @@ MODULES= \
lib \
lists \
log_mf_h \
- map \
+ maps \
math \
ms_transform \
otp_internal \
diff --git a/lib/stdlib/src/erl_eval.erl b/lib/stdlib/src/erl_eval.erl
index fcd1945c63..5f96795d92 100644
--- a/lib/stdlib/src/erl_eval.erl
+++ b/lib/stdlib/src/erl_eval.erl
@@ -253,14 +253,14 @@ expr({map,_, Binding,Es}, Bs0, Lf, Ef, RBs) ->
{value, Map0, Bs1} = expr(Binding, Bs0, Lf, Ef, RBs),
{Vs,Bs} = expr_list(Es, Bs1, Lf, Ef),
ret_expr(lists:foldl(fun
- ({map_assoc,K,V}, Mi) -> map:put(K,V,Mi);
- ({map_exact,K,V}, Mi) -> map:update(K,V,Mi)
+ ({map_assoc,K,V}, Mi) -> maps:put(K,V,Mi);
+ ({map_exact,K,V}, Mi) -> maps:update(K,V,Mi)
end, Map0, Vs), Bs, RBs);
expr({map,_,Es}, Bs0, Lf, Ef, RBs) ->
{Vs,Bs} = expr_list(Es, Bs0, Lf, Ef),
ret_expr(lists:foldl(fun
- ({map_assoc,K,V}, Mi) -> map:put(K,V,Mi)
- end, map:new(), Vs), Bs, RBs);
+ ({map_assoc,K,V}, Mi) -> maps:put(K,V,Mi)
+ end, maps:new(), Vs), Bs, RBs);
expr({block,_,Es}, Bs, Lf, Ef, RBs) ->
exprs(Es, Bs, Lf, Ef, RBs);
@@ -1148,7 +1148,7 @@ match_tuple([], _, _, Bs, _BBs) ->
match_map([{map_field_exact, _, K, V}|Fs], Map, Bs0, BBs) ->
Vm = try
{value, Ke, _} = expr(K, new_bindings()),
- map:get(Ke,Map)
+ maps:get(Ke,Map)
catch error:_ ->
throw(nomatch)
end,
diff --git a/lib/stdlib/src/erl_parse.yrl b/lib/stdlib/src/erl_parse.yrl
index 6d9aafa980..6316db7054 100644
--- a/lib/stdlib/src/erl_parse.yrl
+++ b/lib/stdlib/src/erl_parse.yrl
@@ -896,7 +896,7 @@ normalise({cons,_,Head,Tail}) ->
normalise({tuple,_,Args}) ->
list_to_tuple(normalise_list(Args));
normalise({map,_,Pairs}=M) ->
- map:from_list(lists:map(fun
+ maps:from_list(lists:map(fun
%% only allow '=>'
({map_field_assoc,_,K,V}) -> {normalise(K),normalise(V)};
(_) -> erlang:error({badarg,M})
diff --git a/lib/stdlib/src/io_lib.erl b/lib/stdlib/src/io_lib.erl
index 886939761c..adc9a0cf5f 100644
--- a/lib/stdlib/src/io_lib.erl
+++ b/lib/stdlib/src/io_lib.erl
@@ -278,7 +278,7 @@ write_ref(Ref) ->
erlang:ref_to_list(Ref).
write_map(Map, D) when is_integer(D) ->
- [$#,${,write_map_body(map:to_list(Map), D),$}].
+ [$#,${,write_map_body(maps:to_list(Map), D),$}].
write_map_body(_, 0) -> "...";
write_map_body([],_) -> [];
diff --git a/lib/stdlib/src/map.erl b/lib/stdlib/src/maps.erl
index 6257a90180..218dc28bec 100644
--- a/lib/stdlib/src/map.erl
+++ b/lib/stdlib/src/maps.erl
@@ -17,7 +17,7 @@
%% %CopyrightEnd%
%%
--module(map).
+-module(maps).
-export([
foldl/3,
@@ -46,7 +46,7 @@
-type map() :: term(). %% FIXME: remove when erl_bif_types knows map().
-%% Shadowed by erl_bif_types: map:get/3
+%% Shadowed by erl_bif_types: maps:get/3
-spec get(Key,Map) -> Value when
Key :: term(),
Map :: map(),
@@ -55,7 +55,7 @@
get(_,_) -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:find/3
+%% Shadowed by erl_bif_types: maps:find/3
-spec find(Key,Map) -> {ok, Value} | error when
Key :: term(),
Map :: map(),
@@ -64,7 +64,7 @@ get(_,_) -> erlang:nif_error(undef).
find(_,_) -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:from_list/1
+%% Shadowed by erl_bif_types: maps:from_list/1
-spec from_list([{Key,Value}]) -> Map when
Key :: term(),
Value :: term(),
@@ -73,7 +73,7 @@ find(_,_) -> erlang:nif_error(undef).
from_list(_) -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:is_key/2
+%% Shadowed by erl_bif_types: maps:is_key/2
-spec is_key(Key,Map) -> boolean() when
Key :: term(),
Map :: map().
@@ -81,7 +81,7 @@ from_list(_) -> erlang:nif_error(undef).
is_key(_,_) -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:keys/1
+%% Shadowed by erl_bif_types: maps:keys/1
-spec keys(Map) -> Keys when
Map :: map(),
Keys :: [Key],
@@ -90,7 +90,7 @@ is_key(_,_) -> erlang:nif_error(undef).
keys(_) -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:merge/2
+%% Shadowed by erl_bif_types: maps:merge/2
-spec merge(Map1,Map2) -> Map3 when
Map1 :: map(),
Map2 :: map(),
@@ -100,14 +100,14 @@ merge(_,_) -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:new/0
+%% Shadowed by erl_bif_types: maps:new/0
-spec new() -> Map when
Map :: map().
new() -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:put/3
+%% Shadowed by erl_bif_types: maps:put/3
-spec put(Key,Value,Map1) -> Map2 when
Key :: term(),
Value :: term(),
@@ -117,7 +117,7 @@ new() -> erlang:nif_error(undef).
put(_,_,_) -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:put/3
+%% Shadowed by erl_bif_types: maps:put/3
-spec remove(Key,Map1) -> Map2 when
Key :: term(),
Map1 :: map(),
@@ -126,7 +126,7 @@ put(_,_,_) -> erlang:nif_error(undef).
remove(_,_) -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:to_list/1
+%% Shadowed by erl_bif_types: maps:to_list/1
-spec to_list(Map) -> [{Key,Value}] when
Map :: map(),
Key :: term(),
@@ -135,7 +135,7 @@ remove(_,_) -> erlang:nif_error(undef).
to_list(_) -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:update/3
+%% Shadowed by erl_bif_types: maps:update/3
-spec update(Key,Value,Map1) -> Map2 when
Key :: term(),
Value :: term(),
@@ -145,7 +145,7 @@ to_list(_) -> erlang:nif_error(undef).
update(_,_,_) -> erlang:nif_error(undef).
-%% Shadowed by erl_bif_types: map:values/1
+%% Shadowed by erl_bif_types: maps:values/1
-spec values(Map) -> Keys when
Map :: map(),
Keys :: [Key],
@@ -167,7 +167,7 @@ values(_) -> erlang:nif_error(undef).
V :: term().
foldl(Fun, Init, Map) ->
- lists:foldl(fun({K,V},A) -> Fun(K,V,A) end,Init,map:to_list(Map)).
+ lists:foldl(fun({K,V},A) -> Fun(K,V,A) end,Init,maps:to_list(Map)).
-spec foldr(Fun,Init,Map) -> Acc when
Fun :: fun((K,V,AccIn) -> AccOut),
@@ -179,9 +179,8 @@ foldl(Fun, Init, Map) ->
K :: term(),
V :: term().
-
foldr(Fun, Init, Map) ->
- lists:foldr(fun({K,V},A) -> Fun(K,V,A) end,Init,map:to_list(Map)).
+ lists:foldr(fun({K,V},A) -> Fun(K,V,A) end,Init,maps:to_list(Map)).
-spec map(Fun,Map1) -> Map2 when
@@ -192,12 +191,12 @@ foldr(Fun, Init, Map) ->
V1 :: term(),
V2 :: term().
-
map(Fun, Map) ->
- map:from_list(lists:map(fun
+ maps:from_list(lists:map(fun
({K,V}) ->
{K,Fun(K,V)}
- end,map:to_list(Map))).
+ end,maps:to_list(Map))).
+
-spec size(Map) -> non_neg_integer() when
Map :: map().
@@ -212,4 +211,4 @@ size(Map) ->
K :: term().
without(Ks, M) ->
- map:from_list([{K,V}||{K,V} <- map:to_list(M), not lists:member(K, Ks)]).
+ maps:from_list([{K,V}||{K,V} <- maps:to_list(M), not lists:member(K, Ks)]).
diff --git a/lib/stdlib/src/stdlib.app.src b/lib/stdlib/src/stdlib.app.src
index 9a77ae9d66..a64b8e13c0 100644
--- a/lib/stdlib/src/stdlib.app.src
+++ b/lib/stdlib/src/stdlib.app.src
@@ -71,7 +71,7 @@
lib,
lists,
log_mf_h,
- map,
+ maps,
math,
ms_transform,
orddict,