my attempt to do the exercises in sicp.

Wednesday, July 16, 2008

sicp exercise 2.26


;  Exercise 2.26. Suppose we define x and y to be two lists:
;  (define x (list 1 2 3))
;  (define y (list 4 5 6))
;  What result is printed by the interpreter in response to evaluating each of the following expressions:
;  (append x y)
;  (cons x y)
;  (list x y)


(define x (list 1 2 3))
(define y (list 4 5 6))
(display (append x y)) (newline)
(display (cons x y)) (newline)
(display (list x y)) (newline)

; Answer:
; (1 2 3 4 5 6)
; ((1 2 3) 4 5 6)
; ((1 2 3) (4 5 6))


No comments: