lua-users home
lua-l archive

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


> 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.

If you want to index the positions, where you started, would that be "one step" or "zero steps"?

I don't get it, why everybody is always talking about "counting". Again and again. Nobody is actually ever counting anything, especially data. Even the computer isn't exactly "counting" if you query #array (dunno what the current implementation is, is it still look at the array part counter and then do a divide by half search on the hash part to find an "edge"?). Anyway, what's happening all the time is indexing and indexing only. There is no "counting" only addressing/indexing. What index the first (yes first item) should have, is the question. Does it have index 1 or index 0? I still wonder how the "it's all about counting cows and steps" people can leave with the fact the first year of a decade has a 0. That's so unnatural! After 1999 should come 2111, would be much more natural.

And that's the next thing that's IMO awkward in this discussion. Throwing around "natural". As it would have been somehow wanted by nature. Despite the name "natural number" which has a clear mathematical definition, there is nothing more "natural" or "unnatural". However, there are things that are more in tune with our cultural upbringing in school etc. and things that aren't. As Roberto brought decimal numbers, why almost all programming languages use those as default? Well because we live in a 10-base system world all around us. 12 and 60 systems long died out and only some remnants like time (24 hours, 60 minutes, 60 seconds) remind us once there was a time not everything was 10-based, even outside specializations for ordinary people. Yet sometimes a 16-based system is still and often used in programming, when considered for that task at hand to be beneficial. 

On Mon, Apr 23, 2018 at 6:36 PM, Francisco Olarte <folarte@peoplecall.com> wrote:
On Sun, Apr 22, 2018 at 8:49 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2018-04-22 18:48 GMT+02:00 Francisco Olarte <folarte@peoplecall.com>:
>> On Sun, Apr 22, 2018 at 5:43 PM, ag <aga.chatzimanikas@gmail.com> 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.