Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.python Subject: Re: Another tail recursion example Date: Tue, 28 Jul 2015 14:30:23 -0700 Organization: A noiseless patient Spider Lines: 8 Message-ID: <874mkootqo.fsf@jester.gateway.sonic.net> References: <87bnewott4.fsf@jester.gateway.sonic.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="4fa08f1ce1db3b0ae8c51611453a050c"; logging-data="10275"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18iRPbMO0/UFMPiMaxWYIdo" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:ahtZT17BOgW3o9j2CCy7eufPlRs= sha1:3Q6155coxSPecuR4ANgPfwg/djY= Xref: csiph.com comp.lang.python:94708 Paul Rubin writes: > Chris Angelico was asking for examples of tail recursion that didn't > have obvious looping equivalents. Here's an Euler problem solution > using memoization and (except that Python doesn't implement it) tail > recursion with an accumulator. Actually that's wrong, it's not really tail recursive because of the addition in the memo combinator, whoops ;-).