lua-users home
lua-l archive

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

On Sun, Apr 22, 2018 at 8:49 PM, Dirk Laurie <> wrote:
> 2018-04-22 18:48 GMT+02:00 Francisco Olarte <>:
>> On Sun, Apr 22, 2018 at 5:43 PM, ag <> wrote:
>> ...
>>> So, lets say that we could talk with a just born human child, and asked him:
>>>   how old are you?
>>> Is not one, but is not zero either. He actually is zero and an offset.
>> That question is not counting, is measuring. The thing is sufficiently
>> old people normally reply in truncated years.
> We actually have at least four ways of counting.
> 1. Fortran, Lua etc: from 1 to n.
> 2. C, Python etc: from 0 to n-1.
> 3. When pacing off a fixed length, or counting a time interval: from 0 to n.
> 4. When launching a rocket, detonating an explosive device etc: from n
> backwards to 0.

Totally ok, but I do not understand why you point we have several ways
of counting when I stated that was measuring.

About points 1..2 when indexing in fortran/c/lua/python you use that,
when counting you use whatever is right.
I can count positive values in lua with
local count = 0; for k,v in pairs(t) do; if v>0 then count=count+1 end
Counting is not the same as indexing.

I could as easily start with count=2 if it was right for my program.
And no indexing at all.

Related, about point three. When pacing (aloud) a distance I normally
see people step at the star and count "one, two, three...", no "start"
or "zero" "one, two, three", but that may be a local custom.

Francisco Olarte.