[erlang-questions] error on first run

黃耀賢 (Yau-Hsien Huang) g9414002.pccu.edu.tw@REDACTED
Fri Mar 26 04:02:42 CET 2010


No. Steps are:
1. Paste functions in a file, with the head written as
    -module(mod_name).
    -compile(export_all).
   and name the file as 'mod_name.erl'.
2. Switch to the directory containing 'mod_name.erl' in Erl shell
    by using the command
    > cd("D:\\folder_with_mod_name.erl").
3. Compile the module 'mod_name' by using the command
    > c(mod_name).
    It gives 'ok' when compiling completed.
4. Run the function by calling the function name accompanied with
    module name and arguments.
    > mod_name:factorial(5).

On Fri, Mar 26, 2010 at 10:36 AM, Wes James <comptekki@REDACTED> wrote:

> I'm new to erlang and I've compiled and installed on os x.  I'm going
> through the Erlang Programming 1st edition book.  I fired up erl from
> the cli and I pasted:
>
> factorial(0) -> 1;
> factorial(N) ->
> N * factorial(N-1).
>
> but I get the error:
>
> * 1: syntax error before: '->'
>
> What am I doing wrong?
>
> thx,
>
> -wes
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list