```
Problem 1 Solutions:
1A. (define args-of cdr)
or (define args-of (lambda (expr) (cdr expr)))

if you had (define args-of (cdr expr)) (in other words you forgot the
lambda --> 1 point).
If you forgot a parenth but the rest was correct --> 2 points.

1B (map (lambda (arg) (p-eval arg env)) exps)

if you wrote evaluate or lookup instead of p-eval you got 1 or 2 points.

1C (apply primitive-op vals)

anything that showed that you were trying to apply primitive-ops to vals,
but was wrong still got 1 point.

1D and is a special form not a procedure.
and is not a valid scheme expression; it has no value.

> and
> Unbound variable: and

1E There were many ways to write this. Here is one
(define (and-proc arg . args)
(if (null? args)
arg
(and arg (apply and-proc args))))

worth 10

If you had the correct test and base case for your approach, 2 points.
If you realized you had to cdr down args, but did not use apply on the
recursive call back (or a correct helper proc) you get 2 points.  If
you got the rest wrong but you either defined a helper or used apply
which would yield the correct recursive call back you got 5 points.
This is how partial credit was given on this part with one or two
points to the dicretion of the grader.

Problem 2 Solutions:
2A) The only expression which correctly update op-table is 5. Here is why:

1. The expression updates ops, not op-table
2. (cadr op-table) should be the list of vals. After evaluating
this expression, (cadr op-table) will generate an error, and
(cdr op-table), not (cadr op-table) contains the intended list
of vals.
3. Same problem as 2.
4. Same problem as 2, and the additional problem that '(eq? and-proc)
puts the symbols eq? and and-proc into the vals list. The goal
is to put the procedures that eq? and and-proc evaluate to into
to vals list.
6. Same problem as 2, and the additional problem that none of the
lists have the eq? procedure in the right place.
7. Same problem as 2, and the additional problem that the intended
vals list has only the and-proc procedure.

The grading was 1 point for each correct answer, for a total of
7 points possible on 2A.

2B)

1. (set-car! vals val)
vars is a cons cell whose name is correct, vals is the corresponding
cons cell in the vals-of list, so we need to set the car of vals
to the correct new val.

2. (set-cdr! vars (list name))
In this case, the name was not found in the environment, so we
need to add the name to the end of the vars list. The above
statement will do it. We also accepted expressions that used
append! to put the list on the end of the name, and should
accept expressions that put name on the front of the list, although
I don't think we got any of those.

3. (set-cdr! vals (list val))
Same rationale as 2, except we are now adding the val to the end
of the vals list.

The grading was 4 points for each question, for a total of 12 points
possible on 2B. No partial credit given.

2C)

1. ((a b) (a c))
2. (1 c)
3. ((a c) (1 c))
4. (1 ("LOOKUP: undefined var:"b))

The grading was 1 point for 1 and 2, 2 points for 3 and 3, for a total
of 6 points possible on 2B. 1 point partial credit given on 4 for any

Problem 3 Solutions:
3A.

Any of the following are correct for :

'(? ? ~phrase)			; notice the quote
'(?a ?b ~phrase)
'(?a father ~phrase)
'(my father ~phrase)

For :

'(you mentioned your mother before. would you say you mother ~phrase)

3B.

Any of the following are correct for :

(~ my mother ~)			; notice the absense of a quote
(~pre my mother ~post)

For :

(my father ~)
(my father ~phrase)

For :

(some-rules-application eliza-rules input)

3C.

Given the correct answers in 3A and 3B, the answer for <PARENT
PATTERN> and <FATHER PATTERN> is NONE, while the answer for  <MOTHER
PATTERN> is any datum that contains "my mother" more than once, such
as:

(I love my mother yes I love my mother)	; notice parens
(My mother likes being my mother)

------------------------
------------------------

The grading scheme is as follows:

3A. correct 				2 pts
3A. correct 					1 pt
3B. correct 				2 pts
3B. correct 				1 pt
3B. corrent 					2 pts
Correct use of quotes in 3A and 3B			0.5 pts
3C. correct datum for *			2 pts
3C. correct datum for *			2 pts
3C. correct datum for *			2 pts
Correct use of parens in 3C				0.5 pts

Total							15 pts

* Full credit for correct datum based on your answers for 3A and 3B,
even if those were incorrect.

Problem 4 Solutions:
4A:

*A*: G (1 point)
*B*: G (1 point)
*C*: G (2 points)
*D*: G (2 points)
*E*: 1 (2 points)
*F*: P7 (2 points)
*G*: F1 (2 points)
*H*: F2 (2 points)
*I*: F1 (2 points)
*J*: F2 (2 points)
*K*: F3 (2 points)
*L*: F4 (2 points)

To lower the impact of "double jeopardy", anyone putting down "F1" for
*G* would still get two points off, but an answer of "F4" for *H*
and *J*, and an answer of "F3" for *I* would only take off one point
each.

Since the original formulation of the problem would mean *K* would be
F1 and *L* would be F2, those answers only got one point off, in case
the student missed the correction announced during the test.

4B:

3 frames were created. (3 points)

These were the frames from running (set-car!-of-obj obj obj), the
frame from running (pair 'set-car!), and the frame from executing the
result of (pair ...) with val as the argument.  No partial credit was
given on this problem.

Problem 5 Solutions:

Total:  10 points (2 pts each, no partial credit)

A.   3  fails if s1 is infinite
(elements of s2 will not be in resulting stream)

B.   1  works always

C.   1  works always

D.   2  fails if s1, s2 or s3 are finite
(will try to take stream-car of the-empty-stream)

E.   4  fails if s1, s2 and s3 are finite streams
(loops forever)
fails if s1 and s2 are infinite
(elements of s3 will not be in resulting stream)

```