1、[PoolId, Hostname,Port, Username, Password, Database, LogFun, Encoding, PoolSize] =
foldl(Fun(Elem, AccIn), Acc0, List) -> Acc1 %%AccIn初使为Acc0, Elem是List中的值,把List中的所有值都执行函数一次得到列表
lists:foldl(fun(Key, Acc) ->
[proplists:get_value(Key, Options) | Acc] end, [], lists:reverse([pool_id, hostname, port, username,password,database, logfun, encoding, poolsize]))
注:这儿的Options="[{hostname,"localhost"}, {username, "root"}, {password,"sa"}, {database, "test"}]"
结果为[undefine,"localhost", undefine,"root","sa","test", undefine, undefine, undefine]
2、