SICP- the expression of tree data structure in LISP

38 Views Asked by At

when I read SICP Section 2.2.2, we declare a sequence as

(define x (cons (list 1 2) (list 3 4)))

Then, when press x from my own DrRacket IDE and also the textbook, the result expression for this evaluation is printed as

((1 2) 3 4)

I mean, this expression seems a little bit weird to me, since (list 1 2) and (list 3 4) are equivalent semantically, so I guess the expression for such a data structure might be something like

((1 2) (3 4))

Anyone please point out why the upper result is correct? Also suppose we have such a expression, is there just one solution to recover a tree data structure by iterpreting such a expression?

0

There are 0 best solutions below