[erlang-questions] Tail call optimization

Salikhov Dinislam Dinislam.Salikhov@REDACTED
Mon Oct 17 16:14:41 CEST 2016


Tail call != tail recursive call. The former is more general and 
includes the latter as a particular case.
I'd change the wording as follows:
*6.3 Tail function call*
     If the last expression of a function body is a function call, a 
*tail call optimization* is done.
IMO, it would eliminate any ambiguity here.
Anyway, thank you for clarification.

Salikhov Dinislam

On 10/17/2016 04:57 PM, Pierpaolo Bernardi wrote:
> 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161017/847083a7/attachment.htm>


More information about the erlang-questions mailing list