Gmail eats Python

Jussi Piitulainen jpiitula at ling.helsinki.fi
Sun Jul 26 07:30:36 EDT 2015


Chris Angelico writes:

> On Sun, Jul 26, 2015 at 7:51 PM, Marko Rauhamaa wrote:
>>> - What everyone calls head (of a list) emacs calls Car (Toyota?)
>>
>> Now you're inventing things.
>
> No, but it's LISP rather than Emacs that calls it that. And it dates
> back to an assembly language opcode. Why that got perpetuated in a
> high level language, I don't know - it'd be like building a language
> today and using "interrupt" as the name of its call mechanism, because
> it's built on the Intel INT opcode.

It's stuck partly *because* it's meaningless. Original LISP used
two-field cells (cons cells aka pairs) to build all structured data, and
it wouldn't have been appropriate to tie otherwise useful names for the
two fields. Should "second" mean "cdr" or should it mean "car-of-cdr"?
That depends on what data structure is being implemented by the pair.

There's also a tradition of having composites of car and cdr, up to four
deep (down to four deep?), named like cadr (meaning car of cdr), and
Lispers used to find these transparent (caar "meant" the first key in an
association list and cdar was the associated value, caadr and cdadr were
the second key and value ...). They've resisted the loss of this.

Data structure habits are more abstract now, and some conventional uses
of the concrete list structures come with aliases, notably "first" for
"car", "second" for "cadr", "rest" for "cdr" in Common Lisp.

I suppose early hackers were also incredibly tolerant of obscure names
in general.



More information about the Python-list mailing list