4 ms·
Yes, the author defines exponentiation in terms of recursion. My point is that is not the natural definition of exponentiation, and my evidence is the Wikipedi
by colomon 16y ago
Yes, the author defines exponentiation in terms of recursion. My point is that is not the natural definition of exponentiation, and my evidence is the Wikipedia page, which (as of the time of my original posting of the link, anyway), gives an iterative definition of exponentiation first -- the exact same one I learned in grade school -- and then several pages later mentions a recursive definition as a one-sentence aside.
- delinka 16y agoI'm having problems finding the examples you mention in the wikipedia article. That notwithstanding, I disagree that either method is "natural." Iteration is just what they taught you as a child. If we taught recursion instead (specifically for exponents), then that would be the "natural" method. The point with my C function is that it's certainly simple to do in a non-functional language.