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

Re: [Tads3] knowledge / 'seen' / npc knowledge base



Jesse Welton <jwelton@pacific.mps.ohio-state.edu> wrote:
It sounds to me like this calls for an actual Set collection class,
which could be implemented much like the LookupTable, but saving a
little space by dropping the values.
Agreed - that's the usage I had in mind. I'll think about adding it, although I'm not sure it would really be justified given the light use it would probably see (even counting the space savings and improved abstraction). Any opinions on the value of adding this? - in particular, does anyone think they'd have a lot of use for it?

For those unfamiliar with this particular abstraction, this would be a class with an interface a lot like Vector, but the elements wouldn't be ordered, and the implementation would be optimized for lookup speed, to test if a value is in the set (similar to LookupTable). The interface would probably be something along these lines:

addElement(x)
removeElement(x)
elementCount()
hasValue(val)
hasElementWhich(x)
toList()
subset(func)
applyAll(func)
mapAll(func)
forEach(func)

--Mike

_________________________________________________________________
Need more e-mail storage? Get 10MB with Hotmail Extra Storage. http://join.msn.com/?PAGE=features/es