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