lua-users home
lua-l archive

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




On Thu, May 9, 2019 at 6:25 AM Philippe Verdy <verdy_p@wanadoo.fr> wrote:


Le mer. 8 mai 2019 à 16:00, Coda Highland <chighland@gmail.com> a écrit :
On Tue, May 7, 2019 at 10:00 PM Philippe Verdy <verdy_p@wanadoo.fr> wrote:
abs(n) is as much arbitrary as the number of digits, i.e. roughly log10(abs(n) for integers...

Agreed; log10(abs(n)) is a halfway reasonable but still arbitrary choice that still carries the notion of "size".
 
Also I agree that length == 0 is valid to represent an empty set, but it's still not a valid Lua sequence number.

I'm not sure what you mean by a "sequence number". Do you mean an index? Well of course it isn't. There are no valid indexes into an empty sequence, because it's empty. Why would you EXPECT 0 to be valid? Why does that even matter for anything?

a "sequence number" is almost synonymous here from "index", but "index" is ambiguous as it relates to any table/array that may be indexed ("index" is really a synonymous of "key" which has arbitrary type in Lua). I used "sequence number" because it is related to the definition of sequences which are contiguous spans of non-zero positive integers.

My first reply was related to the fact that you have accepted the "index" 0 which is not a valid sequence number (as returned by ipairs, or used as character positions in strings, which are a compact form of table whose keys are also restricted to non-zero positive integers that also form a sequence of "characters", which do not really exist in Lua because they are represented also by strings of length 1, but that have an accessible code, which is a positive-or-zero integer).

Reread yoiur initial message to which I first replied, you'll notice the error you made in it and why I replied.

My INITIAL message that you replied to said that #n should always be 8. I assume you actually meant the next message, where I dive into a set-theoretic definition of numbers. I've re-read THAT message several times over and nowhere in it did I make any references to using 0 as an index into a sequence -- or indeed to using ANY number as an index into a sequence -- so I'm really quite confused about what you're talking about. I was confused about it when you replied to it in the first place and I'm still confused now, because you seem to be trying to counter something I never said.

/s/ Adam