Exercise 3.14. The following procedure is quite useful, although obscure: (define (mystery x) (define (loop x y) (if (null? x) y (let ((temp (cdr x))) (set-cdr! x y) (loop temp x)))) (loop x '())) Loop uses the ``temporary'' variable temp to hold the old value of the cdr of x, since the set-cdr! on the next line destroys the cdr. Explain what mystery does in general. Suppose v is defined by (define v (list 'a 'b 'c 'd)). Draw the box-and-pointer diagram that represents the list to which v is bound. Suppose that we now evaluate (define w (mystery v)). Draw box-and-pointer diagrams that show the structures v and w after evaluating this expression. What would be printed as the values of v and w ? ———————————————————————————————————————————————————————————————————————— It reverses a list, destroying the original. Specifically it calls loop with the original list and '() as arguments. (loop x y) returns y if x is empty. Otherwise it saves the tail of x, alters x to be the original first element of x followed by y, and calls loop with the saved tail of x and the modified x as arguments. Since the x that is modified is the argument, the original x is destroyed. This has the effect of creating a new list which contains the original elements of x in reversed order, but has the side effect of chopping x up into individual elements; a good example of why mutability is evil.