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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.168.210 with SMTP id e79mr23253865ioj.25.1447796520350; Tue, 17 Nov 2015 13:42:00 -0800 (PST) X-Received: by 10.183.3.106 with SMTP id bv10mr86809obd.17.1447796520291; Tue, 17 Nov 2015 13:42:00 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!i2no4449797igv.0!news-out.google.com!l1ni794igd.0!nntp.google.com!i2no4449790igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 17 Nov 2015 13:42:00 -0800 (PST) In-Reply-To: <87a8qccxj4.fsf@nightsong.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.216.245.129; posting-account=21X1fwoAAABfSGdxRzzAXr3Ux_KE3tHr NNTP-Posting-Host: 82.216.245.129 References: <14533506-4289-4148-b8c4-e970f5778b26@googlegroups.com> <87si45msuz.fsf@nightsong.com> <35d6dc4f-4f2e-4e75-925c-e4acc7c8f112@googlegroups.com> <76ea0bc9-537b-4c68-a728-4f634cf6de52@googlegroups.com> <87a8qccxj4.fsf@nightsong.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0ff849e9-11d7-438d-abf9-853f79348640@googlegroups.com> Subject: Re: Haskell, anyone? From: Hadrien Grasland Injection-Date: Tue, 17 Nov 2015 21:42:00 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:28426 Date: 2015-11-17T13:42:00-08:00 List-Id: Le mardi 17 novembre 2015 19:04:53 UTC+1, Paul Rubin a =E9crit=A0: > > I would say that recursion is the goto statement of functional > > programming languages : necessary in order to achieve > > Turing-completeness, and occasionally useful, but makes control flow > > messy and programs very difficult to reason about, >=20 > No that's continuations ;-). Recursion works fine and is simpler > than loops to reason about and simple to use. Consider these two C code snippets: int iterate_recursion(int n) { ...if (n < 2) { ......return 1; ...} else { ......return iterate_recursion(n-1); ...} } int iterate_goto(int n) { ...beginning: ...if (n < 2) { ......return 1; ...} else { ......n =3D n-1; ......goto beginning; ...} } You have to admit that in the end, the basic approach is almost exactly the= same, and people will need to reason about it in exactly the same way ("ok= ay, so at the start of the iteration, the input parameter is indeed n, but = after that, we'll decrement it and go back to the beginning of the function= , this time with the input parameter equal to n-1, and then..."). Hence my claim that recursion is, indeed, the ultimate goto, including when= it comes to ease of understanding. Guy Steele will be most pleased.