Thread Subject: Dijkstra has died, and "Why Numbering Should Start At Zero"

Subject: Dijkstra has died, and "Why Numbering Should Start At Zero"

From: Stan Pawlukiewicz

Date: 15 Aug, 2002 11:10:48

Message: 1 of 1

robert bristow-johnson wrote:
>
> AJ \"no z\" Johnson wrote:
> >
> > "Steve Amphlett" <samphlett@ricardo.com> wrote in message
> > news:2ae8f62b.0208140017.65bb9cd3@posting.google.com...
> > > Oh well guys, the thread's now four days old and still no TMW
> > > chippers-in! Do you reckon they're developing their killer argument?
> > > Or are they just sitting pretty, knowing that their obviously flawed
> > > product has market share on its side?
> > >
> > > - Steve
> >
> > ...or maybe they are too busy adding an "Index Origin" property to array
> > constructs. One can only hope. I hope it's obvious which court I'm in.
>
> it's nice to feel less alone. when i first brought this up, it seemed
> like everyone, except a few comp.dsp regulars, thought i was goofy.

Now, who... would think that. ;)


Responding to this and the another thread, here in one place.

Take a look at Python. I haven't played with 2.2, but in 1.5 and with
numpy, there is a distinction between an array(n) and a
array(n,1). You can also have an array with indicies

a('bob', 'ted', 'carol', 'alice')

 if you want. The iterator in this case brings a few ideas to mind, but
I won't go there.

It seems like you would like something of the flavor of an associate
memory.

In terms of matricies, zero base indexing might be a bit cleaner in
terms of notation for cyclic objects i.e. a( mod(i,N))

 
>
> > This being the first indexing thread that *I've* read, I am curious what
> > other languages support definable indexing origins?
> > For sure:
> > - Maple (don't know much about it, though)
> > - Pascal, IIRC
> > - APL (choice of 0 or 1 only)
> > - C (array indexing is so loose that one can implement non-zero based
> > indexing, but it is geneally considered bad coding practice)
>
> i don't consider it bad coding practice, at all. i used to do this:
>
> double _my_dummy_array1[1024];
> double my_array[1];
> double _my_dummy_array2[1024];
>
> for (k=-1024; k<=1024; k++)
> {
> do_something_with( my_array[k] );
> }
>
> ****but i was thoroughly chewed out for that since there was no way to
> guarantee that the compiler would put the arrays together like that.
> but if you do:
>
> double *_my_dummy_array = (double *)malloc(2049*sizeof(double));
> double *my_array = _my_dummy_array + 1024;
>
> for (k=-1024; k<=1024; k++)
> {
> do_something_with( my_array[k] );
> }
>
> ****that should be perfectly acceptable coding practice.
>
> > I think Mathworks has gone a long way to meeting customer demands, which is
> > why it's such a comprehensive product now. If only they'd add *my* stuff...
>
> elegance, consiseness, and simplicity is more important to me than
> everything with the kitchen sink. i use very few of the huge set of
> MATLAB functions. i just want them to work correctly.
>
> --
>
> r b-j
> rbj@surfglobal.net a.k.a. robert@wavemechanics.com
>
> "Don't give in to the Dark Side. Boycott intel and microsoft."

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com