Re: Car and cdr (Re: Python syntax in Lisp and Scheme)
Stephen Horne wrote:
[color=blue]
> 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'.[/color]
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 @web.de Institute of Computer Science III
http://www.pascalcostanza.de Römerstr. 164, D-53117 Bonn (Germany)
Stephen Horne wrote:
[color=blue]
> 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'.[/color]
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 @web.de Institute of Computer Science III
http://www.pascalcostanza.de Römerstr. 164, D-53117 Bonn (Germany)
Comment