On Wed, May 18, 2011 at 9:15 AM, rusi <rustompm...@gmail.com> wrote: >> What you're failing to explain is why you would consider that function >> to be recursive from a programming standpoint. > > As for putting + under the format of primitive recursion, it would go > something like this (I guess) > > Matching up that definition > Put > h is what is being defined ie + (or plus) > k = 1 > f = id > g(y, ic, x) = S(ic) #ignore y and x, ic is internal (recursive) call > > Gives > > plus(0, x) = x > plus((S y), x) = S(plus(y, x))
You're still arguing mathematics. I am not disputing that the addition function is primitive recursive (in fact, I asserted that in my original reply). What I am saying is that this *implementation* of the addition function: def add(x, y): return y if x == 0 else add(x-1, y) + 1 is recursive in the programming sense (i.e. it uses the programming technique of recursion), while this implementation is not: def add(x, y): return x + y -- http://mail.python.org/mailman/listinfo/python-list