Tail recursion to while iteration in 2 easy steps
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Mon Oct 7 19:50:48 EDT 2013
On Mon, 07 Oct 2013 15:47:26 -0700, Mark Janssen wrote:
> I challenge you to get
> down to the machine code in scheme and formally describe how it's doing
> both.
For which machine?
Or are you assuming that there's only one machine code that runs on all
computing devices?
Frankly, asking somebody to *formally* describe a machine code
implementation strikes me as confused. Normally formal descriptions are
given in terms of abstract operations, often high level operations,
sometimes *very* high level, and rarely in terms of low-level "flip this
bit, copy this byte" machine code operations. I'm not sure how one would
be expected to generate a formal description of a machine code
implementation.
But even putting that aside, even if somebody wrote such a description,
it would be reductionism gone mad. What possible light on the problem
would be shined by a long, long list of machine code operations, even if
written using assembly mnemonics?
Far more useful would be a high-level description of Scheme's programming
model. If names can be rebound on the fly, how does Scheme even tell
whether something is a recursive call or not?
def foo(arg):
do stuff here
foo(arg-1) # how does Scheme know that this is the same foo?
--
Steven
More information about the Python-list
mailing list