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

Pascal Costanza costanza at web.de
Tue Oct 14 05:53:35 EDT 2003


Stephen Horne wrote:

> 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'.

I think that's the essential point here. The advantage of the names car 
and cdr is that they _don't_ mean anything specific. I wouldn't mind if 
they were called jrl and jol, or rgk and rsk, etc. pp.

This is similar to how array elements are accessed. In expressions like 
a[5], the number 5 doesn't mean anything specific either.


Pascal

-- 
Pascal Costanza               University of Bonn
mailto:costanza at web.de        Institute of Computer Science III
http://www.pascalcostanza.de  Römerstr. 164, D-53117 Bonn (Germany)





More information about the Python-list mailing list