Some thoughts... David Rush (21 Nov 2001 19:26 UTC)
Bad things Re: Some thoughts... Jussi Piitulainen (21 Nov 2001 20:25 UTC)
Re: Bad things Re: Some thoughts... David Rush (22 Nov 2001 16:10 UTC)
Access time of elements Re: Bad things [] Jussi Piitulainen (27 Nov 2001 10:59 UTC)
Re: Access time of elements Re: Bad things [] Per Bothner (27 Nov 2001 17:10 UTC)
Re: Access time of elements Re: Bad things [] David Rush (27 Nov 2001 17:25 UTC)
Re: Access time of elements Re: Bad things [] Per Bothner (27 Nov 2001 17:55 UTC)
Re: Access time of elements Re: Bad things [] David Rush (27 Nov 2001 21:19 UTC)
Re: Access time of elements Re: Bad things [] Jussi Piitulainen (28 Nov 2001 15:40 UTC)
Re: Access time of elements Re: Bad things [] Jussi Piitulainen (28 Nov 2001 16:20 UTC)
Re: Access time of elements Re: Bad things [] Noel Welsh (28 Nov 2001 10:55 UTC)
Re: Access time of elements Re: Bad things [] Jussi Piitulainen (28 Nov 2001 17:21 UTC)

Re: Access time of elements Re: Bad things [] David Rush 27 Nov 2001 17:24 UTC

Per Bothner <xxxxxx@bothner.com> writes:
> Jussi Piitulainen wrote:
>
> >Shall we switch, and is a vector good enough for an index object? (I
> >believe somebody asked for such packaging even apart from efficiency.)
> >
> A modest but not order-or-magnitude difference on a non-optimizing
> implementation is not does not IMO justify a less natural api.
>     --Per Bothner

I would contend that is it a *more* natural API. I find it just as
annoying as the compiler finds it inefficient to scan past an unknown
number of arguments to find something that should *always* be there.

Secondly, the index-type of the data structure should be atomic. It is
an atomic element (a number) in the single-dimensional case. Having a
different index type for a multi-dimensional array is entirely
reasonable - the type signatures of indexed aggregate data structures
all remain the same. Which is more similiar to (vector-set! v index val):

        1 - (array-set! a index val)
     or 2 - (array-set! a index0 index1 index2 val)

The answer seems pretty obvious to me. Others with different esthetic
standards may disagree, but given that one *is* faster, and arguably
(not definitively) cleaner, why not go with it?

david rush
--
To get anywhere with programming we must be free to discuss and
improve subjective phenomena. and leave the objective metrics to
resultants such as bug reports.
	-- The Programmer's Stone (Alan Carter & Colston Sanger)