Exercise 2.24. Suppose we evaluate the expression (list 1 (list 2 (list 3 4))). Give the result printed by the interpreter, the corresponding box-and-pointer structure, and the interpretation of this as a tree (as in figure 2.6).
打印结果
1 ]=> (list 1 (list 2 (list 3 4)))
;Value 3: (1 (2 (3 4)))
box-and-pointer 结构
(1 (2 (3 4)))
+---+---+ +---+---+
-------->| | --+------>| |nil|
+-+-+---+ +-+-+---+
| |
| |
+-+-+ +-+-+---+ +---+---+
| 1 | | | --+------->| |nil|
+---+ +-+-+---+ +-+-+---+
| |
| |
+-+-+ +-+-+---+ +---+---+
| 2 | | | --+------->| |nil|
+---+ +-+-+---+ +-+-+---+
| |
| |
+-+-+ +-+-+
| 3 | | 4 |
+---+ +---+
tree 结构
tree .
/ \
/ \
/ \
/ \
/ \.
1 / \
/ \
/ \
/ \.
2 /\
/ \
/ \
/ \
3 4