aboutsummaryrefslogtreecommitdiffstats
path: root/system/doc/reference_manual/data_types.xml
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 /system/doc/reference_manual/data_types.xml
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 'system/doc/reference_manual/data_types.xml')
-rw-r--r--system/doc/reference_manual/data_types.xml32
1 files changed, 32 insertions, 0 deletions
diff --git a/system/doc/reference_manual/data_types.xml b/system/doc/reference_manual/data_types.xml
index 8c690d6b86..0031664dfb 100644
--- a/system/doc/reference_manual/data_types.xml
+++ b/system/doc/reference_manual/data_types.xml
@@ -190,6 +190,38 @@ adam
</section>
<section>
+ <title>Map</title>
+ <p>Compound data type with a variable number of key-value associations:</p>
+ <pre>
+#{Key1=>Value1,...,KeyN=>ValueN}</pre>
+ <p>Each key-value association in the map is called an
+ <em>association pair</em>. The key and value parts of the pair are
+ called <em>elements</em>. The number of association pairs is said to be
+ the <em>size</em> of the map.</p>
+ <p>There exists a number of BIFs to manipulate maps.</p>
+ <p>Examples:</p>
+ <pre>
+1> <input>M1 = #{name=>adam,age=>24,date=>{july,29}}.</input>
+#{age => 24,date => {july,29},name => adam}
+2> <input>maps:get(name,M1).</input>
+adam
+3> <input>maps:get(date,M1).</input>
+{july,29}
+4> <input>M2 = maps:update(age,25,M1).</input>
+#{age => 25,date => {july,29},name => adam}
+5> <input>map_size(M).</input>
+3
+6> <input>map_size(#{}).</input>
+0</pre>
+ <p>A collection of maps processing functions can be found in
+ the STDLIB module <seealso marker="stdlib:maps"><c>maps</c></seealso>.</p>
+ <p>Read more about <seealso marker="maps">Maps</seealso>.</p>
+ <note>
+ <p>Maps are considered experimental during OTP 17.</p>
+ </note>
+ </section>
+
+ <section>
<title>List</title>
<p>Compound data type with a variable number of terms.</p>
<pre>