From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bill Atkins Newsgroups: gmane.emacs.devel Subject: Re: Documentation for car and cdr Date: Wed, 25 Jan 2006 16:43:06 -0500 Message-ID: <66b7e34b0601251343i254e84c3o4b1bd882f01e2935@mail.gmail.com> References: <85acdlnrqf.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1138225435 24271 80.91.229.2 (25 Jan 2006 21:43:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 25 Jan 2006 21:43:55 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 25 22:43:52 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F1sQT-0003av-Hx for ged-emacs-devel@m.gmane.org; Wed, 25 Jan 2006 22:43:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F1sTE-0007Yq-C9 for ged-emacs-devel@m.gmane.org; Wed, 25 Jan 2006 16:46:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F1sSn-0007Uq-MN for emacs-devel@gnu.org; Wed, 25 Jan 2006 16:46:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F1sSm-0007T6-CG for emacs-devel@gnu.org; Wed, 25 Jan 2006 16:46:00 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F1sSl-0007ST-Iu for emacs-devel@gnu.org; Wed, 25 Jan 2006 16:45:59 -0500 Original-Received: from [64.233.184.204] (helo=wproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1F1sQD-0005S2-RB for emacs-devel@gnu.org; Wed, 25 Jan 2006 16:43:21 -0500 Original-Received: by wproxy.gmail.com with SMTP id i30so206052wra for ; Wed, 25 Jan 2006 13:43:07 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=VWYLTz4T7HnXxddmUKp2m/qaRHhx8knHDGA2iMfPXJHga1rJ4ytAA9FLGOurB5dVQVxTXzgkNGZD2c9lhts21QtdVk5RNiwVK9l+sq2/yXiyV+o4XUguqtPoncB+5tLKaKjRW2Dlv4qfz6sxzvpMPO+WHJS6XNSa8t77XnU7fiI= Original-Received: by 10.64.76.13 with SMTP id y13mr740601qba; Wed, 25 Jan 2006 13:43:06 -0800 (PST) Original-Received: by 10.65.176.8 with HTTP; Wed, 25 Jan 2006 13:43:06 -0800 (PST) Original-To: emacs-devel@gnu.org In-Reply-To: Content-Disposition: inline X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:49538 Archived-At: On 1/25/06, Alan Mackenzie wrote: > > > On Wed, 25 Jan 2006, David Kastrup wrote: > > >Mario Domenech Goulart writes: > > >> Hello, > > >> Currently, the documentation for cdr is: > > >> ,----[ M-x describe-function cdr ] > >> | cdr is a built-in function in `C source code'. > >> | (cdr list) > >> | > >> | Return the cdr of list. If arg is nil, return nil. > >> | Error if arg is not nil and not a cons cell. See also `cdr-safe'. > >> `---- > > [ snip the same for car. ] > > >> Saying "car returns the car" and "cdr returns the cdr" doesn't sound > >> very useful for me if I would like to know what car and cdr do, unless > >> I knew what "car" and "cdr" mean (then I wouldn't check the > >> documentation). :-) > > >> Wouldn't it be better to write something like "Return the first > >> element of list" and "Return a list containing all but the first > >> element of list" for car and cdr, respectively? > > >No. cons cells don't need to point to an atom in their car, or to a > >cons cell or nil in their cdr. This is fundamental Lisp terminology. > >It would be ok to add a cross reference to the Elisp manual, but the > >description of the functions is dead-on and should not be replaced by > >some watered-down half-inaccurate stuff. > > This description of the function is near useless. It is pure sophistry t= o > distinguish between the abstract concept "cdr", and the function "cdr", > as though they were really two different things. It's the sort of thing > that gets me fuming with rage when I encounter it in proprietary > documentation. > > What does this doc-string say to the novice lisp programmer? It says > "We're telling you that the function called \"cdr\" actually returns the > abstract \"cdr\" of a lisp object, just in case that isn't obvious." It > goes on, implicitly by omission, to say "if you really don't know what a > cdr is by this stage, you're so stupid that there's no point in us > bothering to tell you." > > How many other functions could we describe in this way. How about > `bobp', for example? "bobp returns t if bobp is true, otherwise it > returns nil". > > I suggest making this doc-string more helpful by appending the following > to it: > > "Loosely speaking, the cdr of LIST is LIST without its first element." > > , and the other one: > > "Loosely speaking, the car of LIST is its first element.". > > Each of these sentences is completely accurate (by virtue of "loosely > speaking"), regardless of whether LIST is a list, a dotted pair, or nil. > > >David Kastrup, Kriemhildstr. 15, 44793 Bochum > > -- > Alan Mackenzie (Munich, Germany) > > > > > _______________________________________________ > Emacs-devel mailing list > Emacs-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-devel > Why do we need to "speak loosely"? Including a link to a description of cons cells is completely adequate. Your definitions are misleading in any case. CAR and CDR do not necessarily deal with lists; as others have pointed out, a cons is a distinct data structure that is used to compose lists only by convention. These are not "abstract concepts," they're simply how Lisp works. -- Bill Atkins