When you use cdr
on a list
, it means "the rest of the list". The rest of a list is always a list
, not a single element of a list.
If you want the second element of the list xy
, then you need to use cadr
.
(You could also use second
.)
(define xy (list 1 2 3))
(cdr xy) ; '(2 3)
(cadr xy) ; 2
(second xy) ; 2