此方法用于根据列表生成Map。
from_list(Lst)
Lst - 这是需要转换为Map的列表。
基于提供的列表的Map。
链接:https://www.learnfk.comhttps://www.learnfk.com/erlang/erlang-from-list.html
来源:LearnFk无涯教程网
-module(helloLearnfk). -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}
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)