[erlang-questions] Recursion in the shell=impossible?

Circular Function circularfunc@REDACTED
Tue Jun 17 04:14:56 CEST 2008


6> Fac = fun(X) -> N * Fac(N-1).
* 1: syntax error before: '.'
6> Fac = fun(X) -> N * Fac(N - 1).
* 1: syntax error before: '.'
6> Fac = fun(X) -> N * fac(N - 1).
* 1: syntax error before: '.'
6> fac = fun(X) -> N * fac(N - 1).
* 1: syntax error before: '.'

is it not possible to write recursive functions in the shell?
i have to do that ina module?
can i write functiosn any other way than making an anonymous one and assigning it to a variable?
6> Sq = fun(X) -> X*X end.
#Fun<erl_eval.6.13229925>
7> Sq(12).
144
8> 



      ___________________________________________________
Sök efter kärleken!
Hitta din tvillingsjäl på Yahoo! Dejting: http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080617/47f85ff7/attachment.htm>


More information about the erlang-questions mailing list