Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; '16,': 0.03; 'broken': 0.03; 'computed': 0.07; 'exist.': 0.09; 'implies': 0.09; 'subject:module': 0.09; 'vast': 0.09; 'thu,': 0.15; 'iteration.': 0.16; 'loops': 0.16; 'unwound': 0.16; 'wrote:': 0.16; 'all,': 0.20; '2015': 0.20; 'am,': 0.23; 'defined': 0.23; 'examples': 0.24; 'written': 0.24; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'equally': 0.29; 'asked': 0.29; "i'm": 0.30; "can't": 0.32; 'point': 0.33; 'surely': 0.33; 'received:google.com': 0.35; 'best,': 0.35; 'i.e.': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'things': 0.38; 'or,': 0.38; 'sure': 0.39; 'expressed': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'skip:n 10': 0.62; 'believe': 0.66; 'here': 0.66; 'jul': 0.72; '..........': 0.84; 'awhile': 0.84; 'becker': 0.84; 'bounded': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=pu3A0Zv8pnDOmhtP0QOL3vJRm5WKWX2HlzyS905lHuQ=; b=YyO8qEkeb5MkUhqR7bSVnp0ZRCpS54NhBNozchan3JExEp5aYhj7mx10Xo3vrAikXH uFBV7pFSrumKI/Gm9+TwdZfJfET0SNZGORC1gdsXjUHUf/INEdbPVtxzSUj8LBzjJj+2 hYQDzxJn9Y8ItxTddf+Ld3l2Vrfa8xpofCcfeOb33eelNyzJbi+8I3sTPJL5TtEEHFEQ Q6GjG8reOXrNCS2ptBLjLwFsCxiMdkbXKnmOacDqwCYWKjeB0z/D7U9etuVmRB2H2otM bJNkWPMuINFDHf9tsAIyTb8CNzN/WjAZb09HIwqBbozryM1w9WucTmCDPzcIcP/qsHAK W9gg== X-Received: by 10.170.59.205 with SMTP id b196mr3147862ykb.113.1437063468328; Thu, 16 Jul 2015 09:17:48 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <55A77927.7090406@chamonix.reportlab.co.uk> References: <55a3dcd9$0$3024$426a34cc@news.free.fr> <55a76628$0$2846$c3e8da3$76491128@news.astraweb.com> <55A77927.7090406@chamonix.reportlab.co.uk> From: Ian Kelly Date: Thu, 16 Jul 2015 10:17:09 -0600 Subject: Re: A new module for performing tail-call elimination To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437063476 news.xs4all.nl 2829 [2001:888:2000:d::a6]:34033 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4565 X-Received-Body-CRC: 2406845742 Xref: csiph.com comp.lang.python:93934 On Thu, Jul 16, 2015 at 3:28 AM, Robin Becker wrote: > .......... >> >> >> The point is, people keep insisting that there are a vast number of >> algorithms which are best expressed using recursion and which require TCO >> to >> be practical, and yet when asked for examples they either can't give any >> examples at all, or they give examples that are not well-suited to >> recursion. Or, at best, examples which are equally good when written >> either >> using recursion or iteration. >> >> I do believe that such examples surely must exist. But I'm yet to see one. > > .... > I believe the classic answer is Ackermann's function > > http://demonstrations.wolfram.com/RecursionInTheAckermannFunction/ > > which is said to be not "primitive recursive" ie cannot be unwound into > loops; not sure whether that implies it has to be recursively defined or can > perhaps be broken down some other way. My recollection -- and it's been awhile since I've studied computability theory so I may be distorting things here -- is that primitive recursive functions can be computed using for loops, i.e. loops where the number of iterations is bounded in advance, whereas non-primitive recursive functions require while loops.