Re: Why cons *pairs*?
- From: Anton van Straaten <anton@xxxxxxxxxxxxxxxx>
- Date: Sun, 10 Sep 2006 23:19:06 GMT
Tom Lord wrote:
I think you are correct. It seems that what "list" meant
to people at that time and place was, specifically, the familiar
linked list. This seems to come from A. Newell, C. Shaw,
and H. Simon's theoretical and practical work on IPL(-*).
I don't know anything about the history of the term "list", but the idea of representing n-tuples using nested ordered pairs is well-known in mathematics, and I suspect it predates computers. It seems reasonably likely that McCarthy would have been aware of it.
So, Pr. McCarthy's statement that "The first problem was
how to do list structure in the IBM 704," probably means
"how to do linked list structure."
I'm not so sure. I'd say the latter is the answer to the former, i.e. that "linked lists" was the representation chosen for list structure. There are also some good reasons to choose that representation -- more below.
So, instead of wondering if cons pairs are an echo of the
704 architecture, it is safer to wonder if they aren't
simply an echo of IPL 2.
I doubt whether many mathematicians were aware of IPL.
So, why not do away with cons pairs, and go with shared sub-vectors?
(Also note that I'm not just asking about how to implement
things, although that is relevant. In Scheme, cons pairs are
enshrined as a disjoint type -- they can not be mistaken for
vectors of length 2. My question isn't so much "shouldn't
we stop writing programs that use ordered pairs?" as it is
"shouldn't our language not enshrine ordered pairs as a
special case, disjoint type?")
There's no particular reason for ordered pairs to be a special case, but what's wrong with them being a disjoint type?
The importance of lists in statically-typed functional languages like ML and Haskell is relevant here. As in Scheme, the reason lists are so important in those languages is that they support recursive processing and inductive reasoning, including inductive proof. That all depends heavily on operations equivalent to car, cdr, and cons.
If you're going to construct such lists out of something, as opposed to providing lists as a built-in abstraction, then constructing them out of an ordered pair type, which supports (operations equivalent to) car, cdr, and cons, makes a lot of sense. There's no historical accident, or concession to the machine, here.
That's a somewhat separate question from whether cons pairs should be replaced by 2-vectors, though. The reason the latter question even arises in Scheme is because both pairs and vectors in Scheme are mutable, and untyped. In mathematics and in statically-typed functional languages, such properties are used to distinguish different kinds of structures. Scheme blurs those distinctions. If the goal is to "model something true and essential", as stated earlier in the thread, then if anything, support for the expression of such distinctions should be improved, rather than abolished.
Anton
.
- Follow-Ups:
- Re: Why cons *pairs*?
- From: Tom Lord
- Re: Why cons *pairs*?
- References:
- Why cons *pairs*?
- From: Tom Lord
- Re: Why cons *pairs*?
- From: Pascal Bourguignon
- Re: Why cons *pairs*?
- From: Tom Lord
- Why cons *pairs*?
- Prev by Date: Re: Why cons *pairs*?
- Next by Date: Re: Why cons *pairs*?
- Previous by thread: Re: Why cons *pairs*?
- Next by thread: Re: Why cons *pairs*?
- Index(es):
Relevant Pages
|