Circular Function | 1 Jul 14:37

compile buffer, cant execute func in emacs shell

Eshell V5.6.2  (abort with ^G)
1> fibo(12).
** exception error: undefined function shell_default:fibo/1
2> fibonacci:fibo(12).
** exception error: undefined function fibonacci:fibo/1
3>

this works in the shell so there is nothing wrong with the function. if i compile a buffer in emacs with erlangmode it starts the repl/shell but i cant seem to access the functions in the file.

-module(fibonacci).
-export([fib/1,fibo/1, fibo2/1, fibo3/1]).

fib_i(A, _B, 0) -> A;
fib_i(A, B, N) when N > 0 -> fib_i(B, A + B, N - 1).
fib(N) -> fib_i(0, 1, N).

fibo(0) -> 0 ;
fibo(1) -> 1 ;
fibo(N) when N > 0 -> fibo(N-1) + fibo(N-2) .



fibo2_tr( 0, Result, _Next) -> Result ;  %% last recursion output

fibo2_tr( Iter, Result, Next) when Iter > 0 -> fibo2_tr( Iter -1, Next, Result + Next) .

fibo2( N) -> fibo2_tr( N, 0, 1) .

fibo3(N) ->
    {Fib, _} = fibo3(N, {1, 1}, {0, 1}),
    Fib.

fibo3(0, _, Pair) -> Pair;
fibo3(N, {Fib1, Fib2}, Pair) when N rem 2 == 0 ->
    SquareFib1 = Fib1*Fib1,
    fibo3(N div 2, {2*Fib1*Fib2 - SquareFib1, SquareFib1 + Fib2*Fib2}, Pair);
fibo3(N, {FibA1, FibA2}=Pair, {FibB1, FibB2}) ->
    fibo3(N-1, Pair, {FibA1*FibB2 + FibB1*(FibA2 - FibA1), FibA1*FibB1 + FibA2*FibB2}).

Sök efter kärleken!
Hitta din tvillingsjäl på Yahoo! Dejting: http://se.meetic.yahoo.net
<div>
<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top">Eshell V5.6.2&nbsp; (abort with ^G)<br>1&gt; fibo(12).<br>** exception error: undefined function shell_default:fibo/1<br>2&gt; fibonacci:fibo(12).<br>** exception error: undefined function fibonacci:fibo/1<br>3&gt; <br><br>this works in the shell so there is nothing wrong with the function. if i compile a buffer in emacs with erlangmode it starts the repl/shell but i cant seem to access the functions in the file.<br><br>-module(fibonacci).<br>-export([fib/1,fibo/1, fibo2/1, fibo3/1]).<br><br>fib_i(A, _B, 0) -&gt; A;<br>fib_i(A, B, N) when N &gt; 0 -&gt; fib_i(B, A + B, N - 1).<br>fib(N) -&gt; fib_i(0, 1, N).<br><br>fibo(0) -&gt; 0 ;<br>fibo(1) -&gt; 1 ;<br>fibo(N) when N &gt; 0 -&gt; fibo(N-1) + fibo(N-2) .<br><br><br><br>fibo2_tr( 0, Result, _Next) -&gt; Result ;&nbsp; %% last recursion output<br><br>fibo2_tr( Iter, Result, Next) when Iter &gt; 0 -&gt;
 fibo2_tr( Iter -1, Next, Result + Next) .<br><br>fibo2( N) -&gt; fibo2_tr( N, 0, 1) .<br><br>fibo3(N) -&gt;<br>&nbsp;&nbsp;&nbsp; {Fib, _} = fibo3(N, {1, 1}, {0, 1}),<br>&nbsp;&nbsp;&nbsp; Fib.<br><br>fibo3(0, _, Pair) -&gt; Pair;<br>fibo3(N, {Fib1, Fib2}, Pair) when N rem 2 == 0 -&gt;<br>&nbsp;&nbsp;&nbsp; SquareFib1 = Fib1*Fib1,<br>&nbsp;&nbsp;&nbsp; fibo3(N div 2, {2*Fib1*Fib2 - SquareFib1, SquareFib1 + Fib2*Fib2}, Pair);<br>fibo3(N, {FibA1, FibA2}=Pair, {FibB1, FibB2}) -&gt;<br>&nbsp;&nbsp;&nbsp; fibo3(N-1, Pair, {FibA1*FibB2 + FibB1*(FibA2 - FibA1), FibA1*FibB1 + FibA2*FibB2}).<br>
</td></tr></table>
<br><table><tr><td>S&ouml;k efter k&auml;rleken! <br>Hitta din tvillingsj&auml;l p&aring; Yahoo! Dejting: <a href="http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783">http://se.meetic.yahoo.net</a>
</td></tr></table>
</div>

Gmane