diff options
Diffstat (limited to '')
-rw-r--r-- | remote.erl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/remote.erl b/remote.erl new file mode 100644 index 0000000..d3cf88a --- /dev/null +++ b/remote.erl @@ -0,0 +1,23 @@ +-module(remote). +-export([start/0, calculate/1]). + +rpc(C) -> + rechner!{self, C}, + receive + {rechner, Reply} -> + Reply + end. + +loop() -> + receive + {From, {calculate, String}} -> + From ! {rechner, {calculate, calculate(String)}}, + loop() + end. + +start() -> + register(rechner, spawn(fun () -> loop() end)). + +calculate(String) -> + calc:eval(String). + |