Re: [stack] disallowing recursive definitions

John Cowan <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
William Tanksley scripsit:

> I don't know the term "lambda-lift", and Google knows of it mainly as
> a bunch of source files (I did find a 1985 paper on the topic, but
> it's a little dense to answer my questions easily). My question: does
> that include code copying -- in other words, is it possible for a
> single stretch of code-text in the original GOTO program to be present
> in two places in the lambda-lifted code text?

No, it doesn't.  Lambda-lifting is a transformation of an inner (nested)
procedure into a top-level procedure by adding one argument for each
variable that is free in the inner procedure but bound in some enclosing
procedure.  All calls are transformed likewise.

For example:

	(lambda (x y) ... (lambda (z w) ... x ...) ...)

lambda-lifts to:

	(lambda (z-of-x w x) ... x ...)
	(lambda (x y) ... (z-of-x w x) ...)

so z is renamed to z-of-x (or in some other way) and goes from one
argument to two.

This will not work, or at least requires extra machinery, when z is
passed out of x to be called from somewhere else.  But that is not the
case for lambdas made out of tagbody labels.

-- 
John Cowan    [email protected]    http://ccil.org/~cowan
        Sound change operates regularly to produce irregularities;
        analogy operates irregularly to produce regularities.
                --E.H. Sturtevant, ca. 1945, probably at Yale
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.