Erlang尾递归

-module(helloworld).
-export([tail_len/1,tail_len/2,start/0]). 

tail_len(L) -> tail_len(L,0). 
tail_len([], Acc) -> Acc; 
tail_len([_|T], Acc) -> tail_len(T,Acc+1). 

start() -> 
   X = [1,2,3,4], 
   Y = tail_len(X), 
   io:fwrite(~w,[Y]).

相关文章

-module(helloworld). -export([start/0]). start() ->...
-module(helloworld). -export([start/0]). start() ->...
-module(helloworld). -export([start/0]). start() ->...
-module(helloworld). -export([start/0]). start() ->...
-module(helloworld). -export([add/2,start/0]). add(X,...
% Erlang整数 -module(helloworld). -export([start/0]). ...