I have a simple server:
-module(simple_server).
-export([loop/0]).
loop() ->
receive
{fact, N, Sender} ->
Sender ! {factResult, fact(N), self()},
loop();
{fib, N, Sender} ->
Sender ! {fibResult, fib(N), self()},
loop();
{stop, Sender} ->
Sender ! ok
end.
fact(0) -> 1;
fact(N) -> N * fact(N - 1).
fib(N) -> fib(N, 1, 0).
fib(0, _B, A) -> A;
fib(N, B, A) -> fib(N-1, A+B, B).
Then I get this:
...\code>erl simple_server.erl
Eshell V5.7.5 (abort with ^G)
1> Server = spawn('server@myserver', fun simple_server:loop/0).
=ERROR REPORT==== 28-Jun-2010::10:46:29 ===
** Can not start erlang:apply,[#Fun<simple_server.loop.0>,[]] on server@myserver**
<0.33.0>
What did I miss?