[erlang-questions] erlang on windows, cant run module

Circular Function <>
Tue Jun 17 03:47:02 CEST 2008


I have the werl.exe in:
"C:\Program Files\erl5.6.2\bin\werl.exe"

where should I then save my file:

Sq = fun(X) -> X*X end.

I have it now in the bin so the same driectory as werl.exe but when I do:
c(square). I get:
Erlang (BEAM) emulator version 5.6.2 [async-threads:0]

Eshell V5.6.2  (abort with ^G)
1> c(square).
../square.erl:none: no such file or directory
error
2> 


--- Den lör 2008-05-31 skrev Edwin Fine <>:
Från: Edwin Fine <>
Ämne: Re: [erlang-questions] run program from commandprompt? define function?
Till: 
Datum: lördag 31 maj 2008 14.26

You can't define a named function directly in the shell like myfunc() -> ok.. You need to do that in a module.
You *can* define a fun in the shell, for example

Double = fun(X) -> 2 * X end.

Example

Eshell V5.6.2  (abort with ^G)
1> Double = fun(X) -> 2 * X end.
#Fun<erl_eval.6.13229925>
2> Double(2).  
4
3> 
As for your module named tut.erl, you don't copy it to a bin directory. Just work in the current directory. For example:


$ cat tut.erl
-module(tut).
-export([double/1]).

double(X) ->
    2 * X.
$ erl
Erlang (BEAM) emulator version 5.6.2 [source] [64-bit] [smp:4] [async-threads:0] [hipe] [kernel-poll:false]


Eshell V5.6.2  (abort with ^G)
1> c(tut).
{ok,tut}
2> tut:double(2).
4
3> 

Hope this helps.
Edwin

2008/5/31 Circular Function <>:


-module(tut).

-export([double/1]).

double(X) ->
    2 * X.

saved that in tut.erl, placed it in the bin/ and tried to run it but it asks for a specific program to run.

Erlang (BEAM) emulator version 5.6.2 [async-threads:0]


Eshell V5.6.2  (abort with ^G)
1> c(tut).
../tut.erl:none: no such file or directory
error
2> 

so which install do i need?


how do i define a function?

can i do that directlyin the shell?


like in python:
def sq(x): return x*x

how would i dot hat in erlang?


      Sök efter kärleken! 
Hitta din tvillingsjäl på Yahoo! Dejting: http://se.meetic.yahoo.net

_______________________________________________

erlang-questions mailing list



http://www.erlang.org/mailman/listinfo/erlang-questions





      __________________________________________________________
Ta semester! - sök efter resor hos Yahoo! Shopping.
Jämför pris på flygbiljetter och hotellrum här:
http://shopping.yahoo.se/c-169901-resor-biljetter.html?partnerId=96914052
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080617/06fe8b28/attachment.html>


More information about the erlang-questions mailing list