This definition exploits the fact that SCHEME is evaluated in applicative order, and so will evaluate all arguments before applying a function to them. Thus, in the second subrule, x must be evaluated, and then the block of all the rest is. It is then clear from the first subrule that the last argument is evaluated “tail-recursively".
One problem with this definition is the occurrence of the variable DUMMY, which must be chosen so as not to conflict with any variable used by the user. This we refer to as the "GENSYM problem", in honor of the traditional LISP function which creates a "fresh" symbol. It would be nicer to write the macro in such a way that no conflict could arise no matter what names were used by the user. There is indeed a way, which ALGOL programmers will recognize as equivalent to the use of “thunks", or call-by-name parameters:
(BLOCK x) => x
(BLOCK x . rest) => ((LAMBDA (A B) (B))
x
(LAMBDA () (BLOCK . rest)))
Consider carefully the meaning of the right-hand side of the second subrule.
First the expression x and the (LAMBDA () ...) must be evaluated (it doesn‘t
matter in which order!); the result of the latter is a function (that is, a
closure), which is later invoked in order to evaluate the rest of the arguments.
There can be no naming conflicts here, because the scope of the variables A and B
(which is lexical) does not contain any of the arguments to BLOCK written by the
user. (We should note that we have been sloppy in speaking of the "arguments" to
BLOCK, when BLOCK is properly speaking not a function at all, but merely a
syntactic keyword used to recognize a situation where a syntactic rewriting rule
is applicable. We would do better to speak of "argument expressions" or "macro