SICP Practice

Practice 3.14

	(define (mystery x)
	  (define (loop x y)
	    (if (null? x)
	        y
	        (let ((temp (cdr x)))
	          (set-cdr! x y)
	          (loop temp x))))
	  (loop x '()))

	(define v (list 'a 'b 'c))
	v                             ;(a b c)
	(define w (mystery v))
	v                             ;(a)
	w                             ;(c b a)

this process reverse x

the status of v and w after mystery

image