diff options
author | Björn-Egil Dahlberg <[email protected]> | 2014-03-18 15:26:57 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-03-27 18:16:57 +0100 |
commit | 2b42af9aab024db55f57aa5d70751712074f2bab (patch) | |
tree | b60c6f0435d9bbb0569495dc54b029f392b21f3c /system/doc | |
parent | 50cbd99857a674f2b082f5c436b7e721d33f4cd0 (diff) | |
download | otp-2b42af9aab024db55f57aa5d70751712074f2bab.tar.gz otp-2b42af9aab024db55f57aa5d70751712074f2bab.tar.bz2 otp-2b42af9aab024db55f57aa5d70751712074f2bab.zip |
doc: Document Maps datatype in reference manual
Diffstat (limited to 'system/doc')
-rw-r--r-- | system/doc/reference_manual/data_types.xml | 32 |
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> |