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

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Sun Oct 12 22:28:57 EDT 2003


Andrew Dalke wrote:
>    It has sometimes been said that Lisp should use first and
>    rest instead of car and cdr

I used to think something like that would be more logical, too.
Until one day it occurred to me that building lists is only
one possible, albeit common, use for cons cells. A cons cell
is actually a completely general-purpose two-element data
structure, and as such its accessors should have names that
don't come with any preconceived semantic connotations.

 From that point of view, "car" and "cdr" are as good
as anything!

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list