[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vector compare
Mike Sperber wrote:
> Sebastian Egner <sebastian.egner@xxxxxxxxxxx>
> > This is in contrast to the point of view we have taken for this
> > There are two abstract data types called VECTOR and LIST, where
> > VECTOR is specified by a SIZE procedure and a REF procedure
> > (e.g. constant-time random access finite-length sequences) and
> > LIST is specified by procedures EMPTY?, HEAD and TAIL (e.g.
> > unbounded finite stacks).
> But you're omitting a detail here, which is that REF is specified
> terms of natural numbers, which have inductive structure, which could
> be used to justify choosing the list order. Of course, this
> far-fetched, but that, to my mind, also holds for vector comparison
> you picked.
I think we have just beaten this justification horse
There are two really fundamental ways of lifting a
order to finite length sequences: lex and length>lex
These are provided through making them the default
and vectors, which also provide abstract names for
The SRFI gives full choice with convenient notation:
The only issue in the discussion is the definition
DEFAULT-COMPARE, and the more philosophical aspect
to interpret lists and vectors ('two subtypes of sequence'
vs. 'two independent data types').
Scheme (R5RS) doesn't unify lists and vectors at all:
The operations are named entirely different, the set
available operations is totally different (and incomplete),
and operations that could dispatch on representation
(e.g. APPLY) all expect lists as arguments.