[erlang-questions] First Erlang experiences- not so good

Tony Cappellini <>
Thu Sep 25 06:34:45 CEST 2008


I've been going through this intro to Erlang

http://www.onlamp.com/pub/a/onlamp/2007/09/13/introduction-to-erlang.html?page=last#thread

using the Windows version of the
Erlang (BEAM) emulator version 5.6.4 [smp:2] [async-threads:0]
shell.

For some reason, the example.erl file on the above site, will not compile.

I've contacted the autor and he verified the sources that can be
downloaded from the site still compile on his system, which is Linux.
I've even tried typing the few lines in example.erl into a new file
and compiling it, but still have the same problem- below

Eshell V5.6.4  (abort with ^G)
1> c(example).
./example.erl:1: syntax error before: '-'
./example.erl:2: syntax error before: p
./example.erl:4: syntax error before: a
./example.erl:7: syntax error before: a
./example.erl:9: syntax error before: a
./example.erl:10: no module definition
error
2>

Would someone shed some light on what a newbie is doing wrong?
Attached is the example.erl file I tried compiling.

Below are the lines from example.erl as well.

-module(example).
-export([fact/1, fact/2, call_with_five/1]).

fact(0) -> 1;
fact(N) -> N * fact(N-1).

fact(A,B) -> io:format("Chuck Norris kicks ~p people in ~p places ~n", [A,B]).

call_with_five(Func) -> Func(5).


Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.erl
Type: application/octet-stream
Size: 456 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080924/509f3620/attachment.obj>


More information about the erlang-questions mailing list