Primitive List-Manipulating Functions
> (define x '(a b c d))
> (car x) ; CAR returns 1st elt of list
A
> (cdr x) ; CDR returns all but 1st.
(B C D)
> x
(A B C D) ; X has not been changed.
> (cons 'a 'b)
(A . B) ; CONS combines two things.
> (cons 'a ())
(A) ; The result is often a list.
> (cons 'z x)
(Z A B C D)
Previous slide
Next slide
Back to first slide
View graphic version