[erlang-questions] Tail call optimization

Pierpaolo Bernardi olopierpa@REDACTED
Mon Oct 17 15:57:29 CEST 2016


On Mon, Oct 17, 2016 at 2:47 PM, Salikhov Dinislam
<Dinislam.Salikhov@REDACTED> wrote:
>> There is nothing about recursion in documentation.
> The only doc that I've managed to find about the subject is the link from my
> initial post
> (http://erlang.org/doc/reference_manual/functions.html#id78464).
> And it says about recursion: in sub-chapter's header, in sub-chapter itself
> and in the example (all in all, everywhere). Is there another documentation
> that you mean?

Yes, the chapter sub-header has 'recursion' in the name.

But the text says: "If the last expression of a function body is a
function call, a tail recursive call is done."

This in no way can be read as meaning that when the last expression of
a function body is a function call then a tail call is not mandated.

Maybe changing "tail recursive call" to "tail call" would remove an
element of distraction and be more to the point though.



More information about the erlang-questions mailing list