|
A complete newbie question ...
Regarding:
loop(MyName) ->
receive
{ accept, SenderName, Message } ->
io:format("~n~s receives from ~s: ~s ~n", [MyName, SenderName, Message]),
loop(MyName);
{ say, Message } ->
io:format("~n~s says ~s ~n",[MyName, Message]),
room ! { self(), broadcast, MyName, Message },
loop(MyName)
end.
Is "loop(MyName)" a recursive call? ... a goto? What happens under the hood? E.g., is a completely new call stack generated for each "loop(MyName)"?
Thanks for the intro article. It's got me interested in Erlang.
|
I'm mostly an Erlang newbie, so I won't venture into guessing what the optimizations are, but I will say that virtually all Erlang code you write will include recursion in some form or another.
I'm glad you enjoyed the article. I need to dig up and dust off some code that I wrote that does simplified neural networking in Erlang. If I ever do that, you'll find it under an Erlang tag at http://metametta.blogspot.com
-greg