I'm new to Erlang. I have a Map with which I have to create registered processes of all the keys and then further processing. I'm registering the processes in partone module:
-module(partone).
-import(parttwo,[start/2]).
start() ->
{ok,List}=file:consult("file.txt"),
MyMap=maps:from_list(List),
maps:fold(
fun(Key,Value,ok) ->
print_Map([Key],[Value])
end,ok,MyMap),
maps:fold(
fun(K,V,ok) ->
register(K,spawn(calling, startFun,[K,V]))
end,ok,MyMap).
print_Map(Key,Value)->
io:fwrite("~n~w : ~w",[Key,Value]).
parttwo.erl:
-module(parttwo).
-export([startFun/2]).
-import(partone,[startFun/0]).
startFun(Key,Value) ->
io:fwrite("~w~n KEY::",[Key]).
I could get the map contents in the output which is by print_Map. But then I'm getting the following error: {"init terminating in do_boot",{function_clause,[{exchange,'-start/0-fun-1-',[jill,[bob,joe,bob],true],[{file,"d:/exchange.erl"},{line,40}]},{lists,foldl,3,[{file,"lists.erl"},{line,1263}]},{init,start_em,1,[{file,"init.erl"},{line,1085}]},{init,do_boot,3,[{file,"init.erl"},{line,793}]}]}} init terminating in do_boot ({function_clause,[{exchange,-start/0-fun-1-,[jill,[],true],[{},{}]},{lists,foldl,3,[{},{_}]},{init,start_em,1,[{},{}]},{init,do_boot,3,[{},{}]}]})
Crash dump is being written to: erl_crash.dump...done