emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Documentation for car and cdr


From: Drew Adams
Subject: RE: Documentation for car and cdr
Date: Sat, 28 Jan 2006 11:57:32 -0800

The doc strings should *not* mention "list", especially as the
argument name.  There is no reason to do so, and that can be
misleading, due to the use of "list" in the doc for both:

 1) consp or null, and
 2) "true list" (nil as last cdr).


Use the following doc strings (or similar).  They are precise but also
clear enough wrt what the "car" and the "cdr" of a cons cell mean.
The first line provides the raison d'etre and core meaning; the other
lines mention the nil and error cases.

There is no need to cross-reference the manual explanation of "cons
cell", and the manual section on lists should definitely not be
cross-referenced.  Users not understanding these doc strings will
naturally look at the doc for `cons', which is what we want them to
do.

(car ARG):

Return the car (first part) of a cons cell.
ARG must be a cons cell or nil, or else an error is raised.
(car (cons a b)) returns a.
(car nil) returns nil.
See also `car-safe'.

(cdr ARG):

Return the cdr (second part) of a cons cell.
ARG must be a cons cell or nil, or else an error is raised.
(cdr (cons a b)) returns b.
(cdr nil) returns nil.
See also `car-safe'.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]