[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
**Subject**: **Tables for mathematicians**
**From**: Dirk Laurie <dirk.laurie@...>
**Date**: Sat, 20 Aug 2016 08:59:16 +0200

Just in case you thought tables were easy :-)
Let V be the set of all Lua values.
A key in V is a subset k of V, other than {nil}, such that any two members
of k are raw equal. Let K be the set of all keys.
Remarks:
1. Many keys consist of only one value.
2. The subset consisting of only NaN is not a valid key, since NaN is not
raw equal to itself.
An association is any mapping f from K to V.
An implementation of an association f is a Lua table t such that, if j
is any member of a key k, rawget(t,k) returns f(k).
An assocation is said to be implementable if an implementation of it exists.
If t is the implementation of an association f, the operation t[j]=v,
where j belongs to the key k, modifies t to be the implementation of a
a different association f' in such that f'[a] == f[a] when a ~= k.
Postulate: The keys of an implementable association which are mapped
to a non-nil value form a well-ordered set.
The `next` function is a generator for one of the possible orderings
of that well-ordered set.
I could go on ... but note we have not even got close to the issues
people have been dicussing recently!