为什么我的输出没有反映在 Lst1 中?
-module(pmap).
-export([start/0,test/2]).
test(Lst1,0) ->
{ok, [Temp]} = io:fread( "Input the edge weight ", "~d" ),
lists:append([Lst1,[Temp]]),
io:fwrite("~w~n",[Lst1]);
test(Lst1,V) ->
{ok, [Temp]} = io:fread( "Input the edge weight ", "~d" ),
lists:append([Lst1,[Temp]]),
test(Lst1, V-1).
start() ->
{ok, [V]} = io:fread( "Input the number of vertices your graph has ", "~d" ),
Lst1 = [],
test(Lst1,V).
所以,我的 Lst1 正在打印 [],而如果我提供输入 1,2,3,我希望它打印,假设,[1,2,3]。