[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Definition of a sequence
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 11 Jun 2015 16:20:39 +0200
2015-06-11 12:03 GMT+02:00 Mike <lua-l@inbox.ru>:
> On Thu, 11 Jun 2015 11:12:07 +0200
> Oliver Kroth <...> wrote:
>> > Unless a __len metamethod is given, the length of a table t is only defined if the table is a sequence,
> I see, it is reasoned. If we strictly follow the logic,
> the length operator should ideally return nil in these cases,
> because "it usually represents the absence of a useful value".
Detecting that a particular table is not a sequence, as has been
debated ad nauseam on this list, is an O(n) operation which you
can code for yourself if you really must have it.
> I see, it is reasoned. If we strictly follow the logic,
> the length operator should ideally return nil in theese cases,
> because "it usually represents the absence of a useful value".
The value is useful, because it has the property that
t[#t+1] = x
will store x into an empty slot. I wish that the documentation would
restore at least that half of the boundary property.
- References:
- Definition of a sequence, Dirk Laurie
- Re: Definition of a sequence, Tim Hill
- Re: Definition of a sequence, Dirk Laurie
- Re: Definition of a sequence, Tim Hill
- Re: Definition of a sequence, Dirk Laurie
- Re: Definition of a sequence, Tim Hill
- Re: Definition of a sequence, "书呆彭, Peng Yi"
- Re: Definition of a sequence, Andrew Starks
- Re: Definition of a sequence, Mike
- Re: Definition of a sequence, Oliver Kroth
- Re: Definition of a sequence, Mike