Fundamentals of CS I (CS151 2001S) : Reference

car: get the first element of a list

The Basics

Parametersl, a list
PurposeExtracts the first element of a list.
ProducesThe first element of the list.
PreconditionsOne parameter (verified).
l is a list (verified).
l is nonempty (verified).
PostconditionsDoes not affect l.
> (car (cons 'a ()))
> (car (list 'c d e))
> (car 'a)
car: expects argument of type <pair>; given a
> (car ())
car: expects argument of type <pair>; given ()

Disclaimer: I usually create these pages on the fly. This means that they are rarely proofread and may contain bad grammar and incorrect details. It also means that I may update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This page was generated by Siteweaver on Thu Feb 22 05:47:35 2001.
This page may be found at
You may validate this page's HTML.
The source was last modified Sun Feb 4 10:45:07 2001.