the beginner
Matthias Lang
matthias@REDACTED
Wed Apr 30 20:55:47 CEST 2003
wicaksono writes:
> my file math1.erl as Wiliam Dominic writen.
>
> -module(math1).
> -export([factorial/1]).
> factorial (0) ->1;
> factorial (N) -> N * factorial (N-1).
>
> one that make me confused, the error point to line 8 but
> it only has 4 line :(
>
> I have tried to compile with so many formats ( in space
> format), but it still didn't work.
I suspect the file you're compiling is not the one you've shown
above. Perhaps you're starting the compiler in a different directory
to where the file is.
Here's what happens on my system:
matthias >cat math1.erl
-module(math1).
-export([factorial/1]).
factorial (0) ->1;
factorial (N) -> N * factorial (N-1).
matthias >erl
Erlang (BEAM) emulator version 5.1.1 [source]
Eshell V5.1.1 (abort with ^G)
1> c(math1).
{ok,math1}
2> math1:factorial(100).
93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
i.e. it works exactly as intended.
Matt
More information about the erlang-questions
mailing list