[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: New array type? (was: 'table' as fallback for tables)
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 7 Jul 2016 20:06:20 +0200
2016-07-07 18:15 GMT+02:00 Joseph Manning <manning@cs.ucc.ie>:
> On 2016-Jul-07 (Thu) at 09:08 (+0200), steve donovan wrote:
>
>>> It would be cool if #t was O(1), however.
>
> Steve,
>
> In theory, yes indeed, this would be nice and neat and clean.
>
> In practice, however, computing #t is blazingly fast.
The problem that people have with # is not its speed, it is
the non-determinism. I.e. fixed size is conceptually easy,
the first frontier is easy, the largest numeric index is easy,
but some unpredicatable unspecified frontier is sophisticated.
The current equivocation, that # is undefined when the table
is not a sequence, sells it short. The property documented
in the Lua 5.1 manual, that t[#t+1] is guaranteed to be an
empty slot, is a useful one, no matter how many newbies
are puzzled by it.
- References:
- Re: New array type? (was: 'table' as fallback for tables), steve donovan
- Re: New array type? (was: 'table' as fallback for tables), Hisham
- Re: New array type? (was: 'table' as fallback for tables), steve donovan
- Re: New array type? (was: 'table' as fallback for tables), steve donovan
- Re: New array type? (was: 'table' as fallback for tables), Soni L.
- Re: New array type? (was: 'table' as fallback for tables), Tim Hill
- Re: New array type? (was: 'table' as fallback for tables), Soni L.
- Re: New array type? (was: 'table' as fallback for tables), Tim Hill
- Re: New array type? (was: 'table' as fallback for tables), Coda Highland
- Re: New array type? (was: 'table' as fallback for tables), steve donovan
- Re: New array type? (was: 'table' as fallback for tables), Joseph Manning