Procedures (interfaces) Bradd W. Szonye 21 Oct 2003 01:12 UTC

Whoops! I made some mistakes.

On Mon, Oct 20, 2003 at 05:44:29PM -0700, Bradd W. Szonye wrote:
> Also, "insert-left" and "insert-right" should probably be "add-left"
> and "add-right." That way, INSERT and DELETE always require an index
> or key, REMOVE always requires a value, and ADD never requires any of
> them.

No, this isn't right.

Now that I think of it, bags should only have ADD. If the bag is
unordered, then ADD-LEFT and ADD-RIGHT don't make sense. Nor do they
make sense for an ordered bag -- they'd probably violate the ordering.

> Likewise, dictionaries should probably use INSERT and DELETE instead
> of PUT and REMOVE ....

And this isn't right either.

I keep thinking that sequences and dictionaries are basically the same
thing, but they aren't. A sequence has an implicit, numeric ordering. A
dictionary has an explicit, arbitrary way to look up values. While many
people do try to unify them -- the C++ standard library uses the same
syntax for vector and dictionary indexing, for example -- they really
aren't the same thing.

I think the procedures do need an overhaul, but this initial suggestion
was dead wrong. Please give me a little time to go through them and
suggest a more sensible set of procedures.
--
Bradd W. Szonye
http://www.szonye.com/bradd