====================================================================
SparseTable examples
====================================================================

The SparseTable domain provides a general purpose table type with
default entries.

Here we create a table to save strings under integer keys.  The value
"Try again!" is returned if no other value has been stored for a key.

  t: SparseTable(Integer, String, "Try again!") := table()
    table()
                           Type: SparseTable(Integer,String,Try again!)

Entries can be stored in the table.

  t.3 := "Number three"
    "Number three"
                           Type: String

  t.4 := "Number four"
    "Number four"
                           Type: String

These values can be retrieved as usual, but if a look up fails the
default entry will be returned.

  t.3
    "Number three"
                           Type: String

  t.2
    "Try again!"
                           Type: String

To see which values are explicitly stored, the keys and entries
functions can be used.

  keys t
    [4,3]
                           Type: List Integer

  entries t
    ["Number four","Number three"]
                           Type: List String

If a specific table representation is required, the GeneralSparseTable
constructor should be used.  The domain SparseTable(K, E, dflt)} is
equivalent to GeneralSparseTable(K,E,Table(K,E), dflt).

See Also:
o )help Table
o )help GeneralSparseTable
o )show SparseTable

