aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-04-01 11:49:56 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-04-01 11:49:56 +0200
commitac1f6ffb557c5e702722e8b74f616c55cee2cee3 (patch)
tree1ece5d726543c0cd49d005fdb16d36b11481c5e4 /erts
parent3ccf4a77ee8ff4ca86ec2c46c2645607c094e800 (diff)
parentfbb05239aeccc400aa4e4a359a3fb81ef555e441 (diff)
downloadotp-ac1f6ffb557c5e702722e8b74f616c55cee2cee3.tar.gz
otp-ac1f6ffb557c5e702722e8b74f616c55cee2cee3.tar.bz2
otp-ac1f6ffb557c5e702722e8b74f616c55cee2cee3.zip
Merge branch 'egil/maps-doc'
* egil/maps-doc: doc: Add Maps example for sequential programming doc: Mention map expressions and map guards doc: Add maps to reference manual edoc: Add map/0 as a new predefined type doc: Descripe Maps type syntax doc: Clearify language of user-defined attributes doc: Document Maps datatype in reference manual erts: Document map guard functions erts: Fix is_map/1 spec
Diffstat (limited to 'erts')
-rw-r--r--erts/doc/src/erlang.xml20
-rw-r--r--erts/preloaded/src/erlang.erl6
2 files changed, 23 insertions, 3 deletions
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 7aaded200c..e7e9b218f2 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -1784,6 +1784,15 @@ os_prompt% </pre>
</desc>
</func>
<func>
+ <name name="is_map" arity="1"/>
+ <fsummary>Check whether a term is a map</fsummary>
+ <desc>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a map;
+ otherwise returns <c>false</c>.</p>
+ <p>Allowed in guard tests.</p>
+ </desc>
+ </func>
+ <func>
<name name="is_number" arity="1"/>
<fsummary>Check whether a term is a number</fsummary>
<desc>
@@ -2220,6 +2229,17 @@ os_prompt% </pre>
</desc>
</func>
<func>
+ <name name="map_size" arity="1"/>
+ <fsummary>Return the size of a map</fsummary>
+ <desc>
+ <p>Returns an integer which is the number of key-value pairs in <c><anno>Map</anno></c>.</p>
+ <pre>
+> <input>map_size(#{a=>1, b=>2, c=>3}).</input>
+3</pre>
+ <p>Allowed in guard tests.</p>
+ </desc>
+ </func>
+ <func>
<name name="max" arity="2"/>
<fsummary>Return the largest of two term</fsummary>
<desc>
diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl
index fbc37bd955..cabbbd191f 100644
--- a/erts/preloaded/src/erlang.erl
+++ b/erts/preloaded/src/erlang.erl
@@ -1745,9 +1745,9 @@ is_pid(_Term) ->
erlang:nif_error(undefined).
%% Shadowed by erl_bif_types: erlang:is_map/1
--spec is_map(Map) -> boolean() when
- Map :: map().
-is_map(_Map) ->
+-spec is_map(Term) -> boolean() when
+ Term :: term().
+is_map(_Term) ->
erlang:nif_error(undefined).
%% Shadowed by erl_bif_types: erlang:is_port/1