Quiz #1
1a)
Provide the arguments for the two set-cdr! operations in the blanks
below
to produce the indicated effect on list1 and list2. Do not create any
new pairs; just rearrange the pointers to the existing ones.
> (define list1 (list (list 'a) 'b))
list1
> (define list2 (list (list 'x) 'y))
list2
> (set-cdr! _______ _______)
okay
> (set-cdr! _______ _______)
okay
> list1
((a x b) b)
> list2
((x b) y)
1b)
Draw the resulting Box & Pointer Diagram.
2)
What does the mystery procedure do in Exercise 3.14 in Abelson and
Sussman?