English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Erlang Map from_list Method

Erlang Map

This method is used to generate a map from a list.

Syntax

from_list(Lst)

Parameter

  • Lst −This is the list that needs to be converted to a map.

Return Value

Mapping based on the provided list.

-module(helloworld). 
-export([start/0]). 
start(), ->   
   Lst1 = [{"a",1},{"b",2},{"c",3}], 
   io:fwrite("~p~n",[maps:from_list(Lst1).

Output Result

The output of the above program is as follows.

#{"a" => 1,"b" => 2,"c" => 3}

Erlang Map