From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Introductory Presentations, especially aimed at C++ programmers!
Date: Thu, 15 Dec 2016 23:04:09 +0200
Date: 2016-12-15T23:04:09+02:00 [thread overview]
Message-ID: <ebgeq9F9un1U1@mid.individual.net> (raw)
In-Reply-To: <o2uu9g$oq5$1@dont-email.me>
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
. @ .
next prev parent reply other threads:[~2016-12-15 21:04 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-10 12:24 Introductory Presentations, especially aimed at C++ programmers! John McCabe
2009-07-10 21:49 ` jimmaureenrogers
2009-07-10 23:37 ` wwilson
2009-07-11 0:07 ` jimmaureenrogers
2009-07-12 4:00 ` wwilson
2009-07-11 8:15 ` Stephen Leake
2009-07-15 6:43 ` Jean-Pierre Rosen
2016-12-07 17:06 ` john
2016-12-07 17:44 ` Luke A. Guest
2016-12-07 18:35 ` Jeffrey R. Carter
2016-12-07 23:03 ` Randy Brukardt
2016-12-07 23:47 ` Jeffrey R. Carter
2016-12-08 0:08 ` Paul Rubin
2016-12-09 22:01 ` Randy Brukardt
2016-12-09 22:18 ` Jeffrey R. Carter
2016-12-13 0:53 ` Randy Brukardt
2016-12-13 3:21 ` Jeffrey R. Carter
2016-12-13 21:15 ` Robert A Duff
2016-12-13 22:05 ` Jeffrey R. Carter
2016-12-13 22:52 ` Robert A Duff
2016-12-14 0:02 ` Jeffrey R. Carter
2016-12-13 23:05 ` Randy Brukardt
2016-12-14 0:13 ` Jeffrey R. Carter
2016-12-14 22:48 ` Randy Brukardt
2016-12-15 0:00 ` Jeffrey R. Carter
2016-12-15 10:46 ` Maciej Sobczak
2016-12-16 7:37 ` Paul Rubin
2016-12-15 20:14 ` Niklas Holsti
2016-12-15 20:27 ` Jeffrey R. Carter
2016-12-15 21:04 ` Niklas Holsti [this message]
2016-12-15 21:40 ` Jeffrey R. Carter
2016-12-16 7:41 ` Paul Rubin
2016-12-13 22:50 ` Randy Brukardt
2016-12-14 0:08 ` Jeffrey R. Carter
2016-12-14 1:01 ` Shark8
2016-12-08 8:08 ` Maciej Sobczak
2016-12-08 8:38 ` Dmitry A. Kazakov
2016-12-08 10:25 ` Paul Rubin
2016-12-08 13:39 ` Maciej Sobczak
2016-12-09 1:30 ` Paul Rubin
2016-12-09 8:31 ` J-P. Rosen
2016-12-09 8:58 ` Paul Rubin
2016-12-09 9:18 ` J-P. Rosen
2016-12-09 9:27 ` Paul Rubin
2016-12-09 10:49 ` J-P. Rosen
2016-12-09 19:58 ` Jeffrey R. Carter
2016-12-09 8:35 ` G.B.
2016-12-09 8:57 ` Paul Rubin
2016-12-09 22:15 ` Randy Brukardt
2016-12-09 21:58 ` Randy Brukardt
2016-12-08 8:23 ` Maciej Sobczak
2016-12-08 18:54 ` Adam Jensen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox