乐正

Actions speak louder than words.

Sicp-ex2-26

问题

假定已将$x$和$y$定义为如下的两个表:

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

(define y (list 4 5 6))

解释器对于下面各个表达式将打印出什么结果?

1
2
3
4
5
(append x y)

(cons x y)

(list x y)

解答

1
2
3
4
5
6
7
8
(append x y)
;Value 13: (1 2 3 4 5 6)

(cons x y)
;Value 14: ((1 2 3) 4 5 6)

(list x y)
;Value 15: ((1 2 3) (4 5 6))

draft

« sicp-ex2-25 sicp-ex2-27 »

Comments