[erlang-questions] about tail-recursive
Wed Apr 16 10:57:23 CEST 2008
Recently I read http://www.erlang.org/download/armstrong_thesis_2003.pdf.
In this paper 3.3.8, the author talk about tail-recursive:
"Firstly the non tail-recursive way:
factorial(0) -> 1;
factorial(N) -> N * factorial(N-1).
I see this section is non tail-recursive. In my mind, the tail-recursive is
the better, because it do not consuming stack!
When I read OTP src, I find in the stdlib lists.erl. the map/2 write in this
"map(F, [H|T]) ->
map(F, ) when is_function(F, 1) -> .
I think it's non tail-recursive? realy? and why not ?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions