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).


(list 1 (list 2 (list 3 4)))
Evaluator:
(1 (2 (3 4)))
Box and Pointer Notation:
___ ___
|_|_|–|_|_|–nil
\ \ ___ ___
1 |_|_|–|_|_|–nil
\ \ ___ ___
2 |_|_|–|_|_|–nil
\ \
3 4
Tree:
x
/ \
/ \
1 x
/ \
/ \
2 x
/ \
/ \
3 4

view raw

s224.scm

hosted with ❤ by GitHub

 

Discover more from Gaurav Sharma's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading