cdr
Category: List procedures
;;; (cdr lst) -> list?
;;; lst : non-empty-list?
;;; Grabs all but the first element of `lst`.
> (cdr (list 1 2 3))
'(2 3)
> (cdr (cons "x" (cons "y" null)))
'("y")
> (cdr (range 3 8))
'(4 5 6 7)
> (cdr (make-list 5 "z"))
'("z" "z" "z" "z")
> (cdr null)
. . cdr: contract violation
expected: pair?
given: '()
Forthcoming.
Why don’t you have an implementation of cdr
?
cdr
is a primitive procedure. It’s (nearly) impossible to implement it in terms of more basic operations.