I am trying to learn differences between tail recursion and non tail recursion.
Is the following recursive code tail recursive?
If it is not how to convert it to tail recursion?
If it is how to convert it to non tail recursion?
class CastleDefenseI:
INFINITY = 9
def __init__(self):
On Wednesday, August 5, 2015 at 9:21:33 AM UTC-6, Rustom Mody wrote:
> On Wednesday, August 5, 2015 at 8:43:31 PM UTC+5:30, jennyf...@gmail.com
> wrote:
> > I am trying to learn differences between tail recursion and non tail
> > recursion.
> >
> > Is the following recursive code tail recursive?
On Wednesday, August 5, 2015 at 10:10:22 AM UTC-6, Rustom Mody wrote:
> On Wednesday, August 5, 2015 at 9:07:52 PM UTC+5:30, jennyf...@gmail.com
> wrote:
> > On Wednesday, August 5, 2015 at 9:21:33 AM UTC-6, Rustom Mody wrote:
> > > On Wednesday, August 5, 2015 at 8:43:31 PM UTC+5:30, jennyf...@gm
Consider this code (shown in my previous post)
class CastleDefenseI:
INFINITY = 9
def __init__(self):
self.dpw = 0
def soldiersVsDefenders(self,soldiers,defenders):
# soldiers win
if defenders <=0:
return 0
# castle/defenders win
On Wednesday, August 5, 2015 at 10:29:21 AM UTC-6, Chris Angelico wrote:
> On Thu, Aug 6, 2015 at 2:10 AM, Rustom Mody wrote:
> > 1 + x
> > does not *call* 1 .__add__(x)
> > It *is* that
> > [Barring corner cases of radd etc]
> > IOW I am desugaring the syntax into explicit method-calls so you can