Cryptic Erlang Errors
Posted
by Jim
on Stack Overflow
See other posts from Stack Overflow
or by Jim
Published on 2010-06-17T04:33:25Z
Indexed on
2010/06/17
4:43 UTC
Read the original article
Hit count: 265
Okay so I started learning erlang recently but am baffled by the errors it keeps returning. I made a bunch of changes but I keep getting errors. The syntax is correct as far as I can tell but clearly I'm doing something wrong. Have a look...
-module(pidprint). -export([start/0]).
dostuff([]) -> receive begin -> io:format("~p~n", [This is a Success]) end.
sender([N]) -> N ! begin, io:format("~p~n", [N]).
start() -> StuffPid = spawn(pidprint, dostuff, []), spawn(pidprint, sender, [StuffPid]).
Basically I want to compile the script, call start, spawn the "dostuff" process, pass its process identifier to the "sender" process, which then prints it out. Finally I want to send a the atom "begin" to the "dostuff" process using the process identifier initially passed into sender when I spawned it.
The errors I keep getting occur when I try to use c() to compile the script. Here they are..
./pidprint.erl:6: syntax error before: '->' ./pidprint.erl:11: syntax error before: ','
What am I doing wrong?
© Stack Overflow or respective owner