Note: this wiki is now retired and will no longer be updated!

The static final versions of the pages are left as a convenience for readers. Note that meta-pages such as "discussion," "history," etc., will not work.

SICP exercise 2.26

From Drewiki
Jump to: navigation, search

Problem

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)

Solution

(append x y)

Output:

(1 2 3 4 5 6)
(cons x y)

Output:

((1 2 3) 4 5 6)
(list x y)

Output:

((1 2 3) (4 5 6))
Personal tools