From 2b42af9aab024db55f57aa5d70751712074f2bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Tue, 18 Mar 2014 15:26:57 +0100 Subject: doc: Document Maps datatype in reference manual --- system/doc/reference_manual/data_types.xml | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'system/doc') 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 @@ -189,6 +189,38 @@ adam 0 +
+ Map +

Compound data type with a variable number of key-value associations:

+
+#{Key1=>Value1,...,KeyN=>ValueN}
+

Each key-value association in the map is called an + association pair. The key and value parts of the pair are + called elements. The number of association pairs is said to be + the size of the map.

+

There exists a number of BIFs to manipulate maps.

+

Examples:

+
+1> M1 = #{name=>adam,age=>24,date=>{july,29}}.
+#{age => 24,date => {july,29},name => adam}
+2> maps:get(name,M1).
+adam
+3> maps:get(date,M1).
+{july,29}
+4> M2 = maps:update(age,25,M1).
+#{age => 25,date => {july,29},name => adam}
+5> map_size(M).
+3
+6> map_size(#{}).
+0
+

A collection of maps processing functions can be found in + the STDLIB module maps.

+

Read more about Maps.

+ +

Maps are considered experimental during OTP 17.

+
+
+
List

Compound data type with a variable number of terms.

-- cgit v1.2.3