Car and cdr (Re: Python syntax in Lisp and Scheme)

Stephen Horne $$$$$$$$$$$$$$$$$ at $$$$$$$$$$$$$$$$$$$$.co.uk
Mon Oct 13 12:28:58 EDT 2003


On Mon, 13 Oct 2003 14:08:17 +0200, Pascal Costanza <costanza at web.de>
wrote:

>Stephen Horne wrote:
>> On Mon, 13 Oct 2003 15:28:57 +1300, "Greg Ewing (using
>> news.cis.dfn.de)" <g2h5dqi002 at sneakemail.com> wrote:

>>>From that point of view, "car" and "cdr" are as good
>>>as anything!
>> 
>> 
>> "left" and "right" - referring to 'subtrees'?

>Note: Why break anyone else's code just because you prefer a different 
>vocabulary?

I wasn't really suggesting a change to lisp - just asking if they
might be more appropriate names.

Actually, I have been having a nagging doubt about this.

I had a couple of phases when I learned some basic lisp, years ago. A
bit at college in the early nineties, and IIRC a bit when I was still
at school in the mid eighties. This was well before common lisp, I
believe.

Anyway, I'd swear 'car' and 'cdr' were considered backward
compatibility words, with the up-to-date words (of the time) being
'head' and 'tail'.

Maybe these are/were common site library conventions that never made
it into any standard?

This would make some sense. After all, 'head' and 'tail' actually
imply some things that are not always true. Those 'cons' thingies may
be trees rather than lists, and even if they are lists they could be
backwards (most of the items under the 'car' side with only one item
on the 'cdr' side) which is certainly not what I'd expect from 'head'
and 'tail'.


-- 
Steve Horne

steve at ninereeds dot fsnet dot co dot uk




More information about the Python-list mailing list