[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua design : why no lists ?
- From: Rici Lake <lua@...>
- Date: Thu, 16 Sep 2004 12:27:07 -0500
On 16-Sep-04, at 11:38 AM, Mark Hamburg wrote:
What Lua doesn't support as efficiently are sets where there are a
keys to hash but the values are all "true".
In many cases where there are a large number of such sets, all these
sets share a single key domain (universe). (Option sets, for example,
or state sets). In this case, you can create a Universe table which
maps keys to integers and vice versa (assuming the keys cannot be
integers, otherwise you need two tables), and implement the set itself
as a long bit-vector; the only Lua object which needs to be referenced
is the universe itself.