From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!feeder.erje.net!1.eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Introductory Presentations, especially aimed at C++ programmers! Date: Thu, 15 Dec 2016 23:04:09 +0200 Organization: Tidorum Ltd Message-ID: References: <1905815374.502825168.454102.laguest-archeia.com@nntp.aioe.org> <877f7b5llo.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net RjP2C8GbAEqhSipvREDitQtIUcIIJI9EhuvZWlmJF63RjvoSaA Cancel-Lock: sha1:9JZsH0jNRd8j7i/4F3Ggyt+3DnM= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:32856 Date: 2016-12-15T23:04:09+02:00 List-Id: On 16-12-15 22:27 , Jeffrey R. Carter wrote: > On 12/15/2016 01:14 PM, Niklas Holsti wrote: >> On 16-12-15 02:00 , Jeffrey R. Carter wrote: >> >>> Also >>> >>> return Line & Get_Line; >>> >>> is tail recursion; >> >> No, the last operation called is "&", not Get_Line. > > In Erlang, > > list_length ([]) -> > 0; > list_length ([First | Rest]) -> > 1 + list_length (Rest). > > is considered tail recursion and is required to be optimized away, so > that's how I was using the term. Can you give me a reference on that? I'm skeptical. According to the Erlang manual I found, http://erlang.org/doc/pdf/otp-system-documentation.pdf, section 5.6.3, "If the last expression of a function body is a function call, a tail recursive call is done", but goes on to say that this example of the factorial function: fact(N) when N>0 -> N * fact(N-1); fact(0) -> 1. is "not tail-recursive, since a multiplication is done on the result of the recursive call to fact(N-1)". -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .