Re: Another tail recursion example

2015-07-28 Thread Terry Reedy
On 7/28/2015 5:28 PM, Paul Rubin wrote: Chris Angelico was asking for examples of tail recursion that didn't have obvious looping equivalents. Since there is a mechanical procedure for producing the equivalent *under the assumption that the function name will not be rebound*, he is effectivel

Re: Another tail recursion example

2015-07-28 Thread Ian Kelly
On Jul 28, 2015 1:36 PM, "Paul Rubin" wrote: > > 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 > > recursi

Re: Another tail recursion example

2015-07-28 Thread Paul Rubin
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 r

Another tail recursion example

2015-07-28 Thread Paul Rubin
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. # Solution to Euler problem 14, using memoization # h