問題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 '()))

;;リストを破壊的に逆転させる?

(mystery '(1 2 3 4 5))
(5 4 3 2 1)
;; ok

(define v '(a b c d))
(define w (mystery v))
;v -> (a)
;w -> (d c b a)