Tail recursion to while iteration in 2 easy steps

Mark Janssen dreamingforward at gmail.com
Mon Oct 7 20:16:35 EDT 2013


On Mon, Oct 7, 2013 at 4:50 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> 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?

Right, I should stop assuming a modern implementation of vonNeumann
architecture (even though that, too, is ambiguous) since I'm talking
about theory, but yet it is relevant.  My demarcation point for
arguments between "the scheme way" and other procedural languages
(which, apart from Pascal variants, I blithely all "the C way") gets
down to differing models of computation which shouldn't get conflated,
even though everyone thinks and lumps it all as "computation".  They
simply can't get *practically* translated between one and the other,
even though they are *theoretically* translated between each other all
the time.  Humans, of course know how to translate, but that doesn't
count from the pov of computer *science*.

> 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.

It's like this: there *should* be one-to-one mappings between the
various high-level constructs to the machine code, varying only
between different chips (that is the purpose of the compiler after
all), yet for some operations, in languages like scheme, well... I
cannot say what happens...  hence my challenge.

> 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?

Only that you've got a consistent, stable (and therefore,
formalizable) translation from your language to the machine.  That's
all.  Everything else is magic.  Do you know that the Warren
Abstraction Engine used to power the predicate logic in Prolog into
machien code for a VonNeumann machine is so complex, no one has
understood it (or perhaps even verified it)?   One hardly knows where
these things originate.  But here it gets into dark arts best not
entered into too deeply.  It will turn you mad, like that guy in the
movie "pi".

-- 
MarkJ
Tacoma, Washington



More information about the Python-list mailing list