灯下 登录
计算机科学 / SICP / 5.3.1 Memory as Vectors

Exercise 5.20 · 习题

Exercise 5.20: Draw the box-and-pointer
representation and the memory-vector representation (as in Figure 5.14)
of the list structure produced by

(define x (cons 1 2))
(define y (list x x))

with the free pointer initially p1. What is the final value of

free? What pointers represent the values of x and y?

练习 5.20:画出由以下代码产生的表结构的序对指针表示和内存向量表示(如图 5.14 所示):

(define x (cons 1 2))
(define y (list x x))

设空闲指针初始值为 p1。free 的最终值是什么?x 和 y 的值分别由哪些指针表示?

Racket #lang sicp
(define x (cons 1 2))
(define y (list x x))