Forgot to reply-all, here it is again:<br><div class="gmail_quote"><br>c(tut) will look in the current directory. So if you moved it to bin, you should run erl from there or do:<div>cd("bin").</div><div><br></div>
<div>from the shell</div><div>as for defining functions from the shell, I don't believe you can define normal module:function/arity style functions like in your tut.erl (that function being tut:double/1)</div>
<div><br></div><div>but you can define fun's from the shell and call them, example:</div><div><div>1> Double = fun(X) -> 2 * X end.</div><div>#Fun<erl_eval.6.13229925></div><div>2> Double(5).</div><div>
10</div><div>3> </div></div><div><br>the difference here is you have to make anonymous functions and bind them to variables. so they won't look quite the same as from a source file where you use lowercase atom names.</div>
<div><br></div><div>make sense?</div><div><br><div class="gmail_quote">2008/5/31 Circular Function <<a href="mailto:circularfunc@yahoo.se" target="_blank">circularfunc@yahoo.se</a>>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div></div><div class="Wj3C7c">
<table cellspacing="0" cellpadding="0" border="0" style="font-family:arial;font-size:10pt;color:rgb(51, 51, 51);background-color:rgb(255, 255, 255);width:100%"><tbody><tr><td valign="top" style="font:inherit">-module(tut).<br>
-export([double/1]).<br><br>double(X) -><br> 2 * X.<br><br>saved that in tut.erl, placed it in the bin/ and tried to run it but it asks for a specific program to run.<br><br>Erlang (BEAM) emulator version 5.6.2 [async-threads:0]<br>
<br>Eshell V5.6.2 (abort with ^G)<br>1> c(tut).<br>./tut.erl:none: no such file or directory<br>error<br>2> <br><br>so which install do i need?<br><br><br>how do i define a function?<br><br>can i do that directlyin the shell?<br>
<br>like in python:<br>def sq(x): return x*x<br><br>how would i dot hat in erlang?<br></td></tr></tbody></table><div><br>
<hr size="1"><table><tbody><tr><td>Sök efter kärleken! <br>Hitta din tvillingsjäl på Yahoo! Dejting: <a href="http://ad.doubleclick.net/clk;185753627;24584539;x?http://se..meetic.yahoo.net/index.php?mtcmk=148783" target="_blank">http://se.meetic.yahoo.net</a></td>
</tr></tbody></table></div><br></div></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br></div>
</div><br>