quation how to use erlang

Robert Virding <>
Tue Mar 7 13:04:29 CET 2000


"atif dahab" <> writes:
>
>While running a program written in Microsoft WordPad  on Windows95 
platform
>I faced a problem.
>
>The program name is: math1.era
>The path is: C:\Program Files \era 4.9.1\math1
>Erlang programs are in the directory: C:\Program Files \era 4.9.1
>
>The program syntax is:
>- module (math1).
>- export ([factorail/1]).
>factorial (0) -> 1;
>factorial (n) -> n* factorial (n-1);
>
>The error massage is:
>
>./ math1.era: next form/ expression contains unterminated string stating 
>with “
>\000\ 062 Default prgr”
>./ math1.era: 7: no module definition
>error

My first guess would be that WordPad is adding formatting information to the fle not just the program text.  Erlang treats everything as program text.  My sggestion would be to turn off this on output in Wordpad if possible or use anoher editor like NotePad which only outputs the text or Emacs for which there i a good Erlang mode.

Another point is that in Erlang variables start with a capital letter, the `n'in your example is the atom 'n' which would give a runtime error.  The last cluse in a function ends in a `.' not a `;' so:

-module (math1).
-export ([factorial/1]).

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

	Robert

-- 
Robert Virding                          Tel: +46 (0)8 692 22 12
Bluetail AB                             Email: 
Hantverkargatan 78                      WWW: http://www.bluetail.com
SE-112 38 Stockholm, SWEDEN
"Folk säger att jag inte bryr mig om någonting, men det skiter jag i".





More information about the erlang-questions mailing list