Page:Scheme - An interpreter for extended lambda calculus.djvu/35



We come to  when a combination is encountered. The intention is to evaluate each component of the combination and then apply the resulting function to the resulting arguments. We use the register  to hold the list of components yet to be evaluated, and the register   to hold the list of evaluated components. We assume that these have been set up by. Note that in the case of an explicit  expression in the   of a combination   is initialized to be the list of unevaluated arguments and   is initialized to be the list containing the lambda expression.

checks to see if there remain any more components yet to be evaluated. If not, it applies the function. Note that the primitive operators are applied using the LISP function. Note also how a  expression controls the environment in which its body is to be evaluated. expressions are  tags (see  ). It is interesting that the evaluated components are collected in the reverse order from that which we need them in, and so we must reverse the list before applying the function. Do you see why we must not use side effects (e.g. the  function) to reverse the list? Think about !

If there remain components yet to be evaluated,  saves up a frame,