lua-users home
lua-l archive

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


Andrew Starks <andrew@starksfam.org> wrote:
> Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> > I am not sure I understand what you are saying, but it is worth
> > mentioning that sequences can have non-integer keys. For instance,
> > {10, 20, 30, x=13, y=print} is a valid sequence in Lua.
>
> And so is...
> 
> {10, 20, 30, x=13, y=print, [5] = 50}
> 
> I would say that the above table contains a sequence. By that definition,
> any table with a non-nil value at index `1` contains a valid sequence.

On the one hand, I hear you. It ‘contains a sequence’, but I wouldn’t be
inclined to say that it *is* a valid sequence. The presence of integer keys
with a hole would prevent me from saying it is a valid sequence. Maybe
a bigger question is this: once the table looks like the last one here,
*why* call it a sequence? (I’m trying to imagine a case where it would make
sense to treat the first three items as a valid sequence and the rest
otherwise. I’m failing.)

Peter
-- 
We have not been faced with the need to satisfy someone else's
requirements, and for this freedom we are grateful.
    Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System