
此方法用于从列表生成映射。
语法
from_list(Lst)
参数
Lst −这是需要转换为映射的列表。
返回值
基于提供的列表的映射。
-module(helloworld).
-export([start/0]).
start() ->
Lst1 = [{"a",1},{"b",2},{"c",3}],
io:fwrite("~p~n",[maps:from_list(Lst1)]).输出结果
上面程序的输出如下。
#{"a" => 1,"b" => 2,"c" => 3}