Erlang运行时错误

| 我正在开发一个erlang程序,并遇到一个奇怪的运行时错误。知道为什么吗?谢谢! 错误是(成功编译程序之后):
   8> PID = spawn(planner,start,[]).
   ** exception error: no match of right hand side value <0.65.0>
   9> 
这是程序:
-module(planner).
-export([start/0]).

start() ->
    loop([],[]).

loop(ContactsList,EventsList) ->
receive

    {contact, Last, First, Number} ->
        loop([{Last,First,Number}|ContactsList],EventsList);

    {event, Date, Time, What} -> 
        loop([{Date,Time,What}|ContactsList],EventsList);

    print_contacts ->
        NewList=lists:sort(ContactsList),
        lists:foreach(fun(Elem)->io:format(\"~p~n\", [Elem]) end, NewList),
        loop(ContactsList,EventsList);

    print_events ->
        NewList=lists:sort(EventsList),
        lists:foreach(fun(Elem)->io:format(\"~p~n\", [Elem]) end, NewList),
        loop(ContactsList,EventsList);

    exit ->
        io:format(\"Exiting.~n\");

    _ -> 
        io:format(\"Dude, I don\'t even know what you\'re talking about.~n\"),
        loop(ContactsList,EventsList)
end.
    
已邀请:
变量
PID
可能设置为其他值,但与您在shell中输入的前一行中的
<0.65.0>
相同:
5> PID = spawn(...).
<0.42.0>
8> PID = spawn(...).
** exception error: no match of right hand side value <0.65.0>
这有效地使生成错误的行类似于
8> <0.42.0> = <0.65.0>.
这将导致\“ no match \”错误。 该问题的更明显说明:
1> X = 1.
1
2> X = 2.
** exception error: no match of right hand side value 2
关于解决您的问题:您可能想运行
f(PID)
以使shell忘记
PID
变量,或者甚至是
f()
以使Shell忘记所有变量。     

要回复问题请先登录注册