Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'broken': 0.03; 'exist.': 0.09; 'implies': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'vast': 0.09; 'iteration.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'unwound': 0.16; 'all,': 0.20; 'defined': 0.23; 'examples': 0.24; 'written': 0.24; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'function': 0.28; 'equally': 0.29; 'asked': 0.29; "i'm": 0.30; "can't": 0.32; 'point': 0.33; 'surely': 0.33; 'best,': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'or,': 0.38; 'sure': 0.39; 'expressed': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'more': 0.63; 'believe': 0.66; 'received:109': 0.75; '.....': 0.76; 'becker': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robin Becker Subject: Re: A new module for performing tail-call elimination Date: Thu, 16 Jul 2015 10:28:07 +0100 References: <55a3dcd9$0$3024$426a34cc@news.free.fr> <55a76628$0$2846$c3e8da3$76491128@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 109.174.168.73 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <55a76628$0$2846$c3e8da3$76491128@news.astraweb.com> 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437038898 news.xs4all.nl 2854 [2001:888:2000:d::a6]:47217 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:93918 .......... > > 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. For more eye-glazing http://math.stackexchange.com/questions/75296/what-is-the-difference-between-total-recursive-and-primitive-recursive-functions -- Robin Becker