灯下 登录
计算机科学 / SICP / 3.3.1 Mutable List Structure

Exercise 3.20 · 习题

Exercise 3.20: Draw environment diagrams to
illustrate the evaluation of the sequence of expressions

(define x (cons 1 2))
(define z (cons x x))

(set-car! (cdr z) 17)

(car x)
17

using the procedural implementation of pairs given above. (Compare

Exercise 3.11.)

练习 3.20:请画出环境图,说明如下表达式序列的求值过程:

(define x (cons 1 2))
(define z (cons x x))

(set-car! (cdr z) 17)

(car x)
17

请使用上面给出的序对的过程式实现。(对比练习 3.11。)

Racket #lang sicp
(define x (cons 1 2))
(define z (cons x x))

(set-car! (cdr z) 17)

(car x)
17