lua-users home
lua-l archive

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


On Mon, 7 Jun 2010, T T wrote:
> On 7 June 2010 02:53, Javier Guerra Giraldez <javier@guerrag.com> wrote:
> >
> > can you suggest such a definition that also:
> > - is useful for tables without holes
> > - is quick to compute
> > - has none or minimal memory requirements.
> > - has none or minimal overhead on field assignment
>
> The one given in the starting message of this thread seems to be the
> most suitable from the "usefulness" POV:
>
> "The length of a table t is defined to be the least non-negative
> integer n such that t[n+1] is nil and t[m] is non-nil for any
> positive integer m less than n+1."?

That fails the second or fourth requirement, as we have been discussing.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
FORTIES CROMARTY FORTH TYNE DOGGER: VARIABLE BECOMING MAINLY EAST 3 OR 4,
DECREASING 2 AT TIMES, OCCASIONALLY 5 IN FORTIES AND DOGGER LATER. SLIGHT,
OCCASIONALLY MODERATE IN FORTIES AND DOGGER. OCCASIONAL RAIN OR DRIZZLE. GOOD,
OCCASIONALLY POOR.