以下の内容はhttps://kiririmode.hatenablog.jp/entry/20080308/p3より取得しました。


問題3-14 (3.3.1 Mutable List Structure)

mystery によって何が起こるでしょう!

(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 'd))
(define w (mystery v))
(print w) ; (d c b a)

見事に reverse になるんですけど,このときの構造は下のような感じ.




以上の内容はhttps://kiririmode.hatenablog.jp/entry/20080308/p3より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14