lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Aug 30, 2011 at 09:00:15AM +0200, steve donovan wrote:
> On Tue, Aug 30, 2011 at 8:30 AM, Axel Kittenberger <axkibe@gmail.com> wrote:
> > 1.5.1 Why do Lua arrays count from one not zero?
> > The answer does not answer the question. Why?
> 
> That's a good point. In my experience engineers and scientists (who
> have been infected with the Excel virus and hack with VBA) don't get
> arrays starting at zero. And they can't read curly-brace languages
> either.
> 

Because *people* count from one, not zero.  

We do that in kindergarten, in music, when starting a race, when drawing
up an agenda, everywhere.  One, two,three, etc have their counterparts in 
every known language on earth.

Zero, on the other hand, is an advanced concept.  Humanity could prove 
that sqrt(2) is not a rational number centuries before anybody thought 
that a symbol for zero might be useful.

A harder question would be "why do arrays in some other languages count 
from zero not one?"  The answer for C is a good one: "so that *(A+k) and 
A[k] mean the same".  For Python, the answer seems to be "because it's 
that way in C".

Dirk