Name:______________________________________            Page 6

Problem 3 (continued).

D. To understand how the cost of evaluation of expressions can be
affected by the representation of environment structures, it is
instructive to consider the cost of application of a procedure with
different representations of environments.  In this problem we will
measure the cost in terms of the number of CONS cells that are made
in the process of evaluating expressions.

In general, this cost depends upon the number of arguments to be bound
to formal parameters of the procedure.  Assume we have already defined
the following simple procedures:

     (define arg0 (lambda () 1))

     (define arg1 (lambda (x) 1))

     (define arg2 (lambda (x y) 1))

Compare Ben's representation of the environment with the one supplied
in the handout by answering the following questions.  Be careful,
these answers cannot simply be deduced from the diagrams you have
drawn in parts A and C above.  If you wish, you may provide a brief
explanation of your answers.

  1. How many CONS cells are made in the process of evaluation of the
     expression (ARG0)?

      With the representation in the handout: ___________

		   With Ben's representation: ___________


  2. How many CONS cells are made in the process of evaluation of the
     expression (ARG1 3)?

      With the representation in the handout: ___________

		   With Ben's representation: ___________


  3. How many CONS cells are made in the process of evaluation of the
     expression (ARG2 3 4)?

      With the representation in the handout: ___________

		   With Ben's representation: ___________


  Your explanation (optional):


