==================================================================== General Sparse Table ==================================================================== Sometimes when working with tables there is a natural value to use as the entry in all but a few cases. The GeneralSparseTable constructor can be used to provide any table type with a default value for entries. Suppose we launched a fund-raising campaign to raise fifty thousand dollars. To record the contributions, we want a table with strings as keys (for the names) and integer entries (for the amount). In a data base of cash contributions, unless someone has been explicitly entered, it is reasonable to assume they have made a zero dollar contribution. This creates a keyed access file with default entry 0. :: patrons: GeneralSparseTable(String, Integer, KeyedAccessFile(Integer), 0) := table() ; Now patrons can be used just as any other table. Here we record two gifts. :: patrons."Smith" := 10500 patrons."Jones" := 22000 Now let us look up the size of the contributions from Jones and Stingy. :: patrons."Jones" patrons."Stingy" Have we met our seventy thousand dollar goal? :: reduce(+, entries patrons) So the project is cancelled and we can delete the data base: :: )system rm -r kaf*.sdata See Also: * ``)show GeneralSparseTable``