Table: Table Operations

$func  Table        = s.Tab;
$func  Bind         s.Tab (e.Key) (e.Val) = ;
$func  Unbind       s.Tab e.Key = ;
$func? Lookup       s.Tab e.Key = e.Val;
$func? IsInTable    s.Tab e.Key = ;
$func  Domain       s.Tab = e.Domain ;
$func  TableCopy    s.Tab = s.TabCopy;
$func  ReplaceTable s.TargetTable s.SourceTable = ;

Table creates a new empty table, and returns a reference to this table.

Bind binds the key e.Key to the value e.Val in the table referred to by s.Tab.

Unbind removes the key e.Key as well as the value associated with the key in the table referred to by s.Tab. If the table does not contain the key e.Key, the state of the table remains unchanged.

Lookup returns the value associated with the key e.Key in the table referred s.Tab. If the table does not contain the key e.Key, the function returns $fail(0).

IsInTable tests whether the table referred to by s.Tab contains the key e.Key.

Domain returns the list of the keys registered in the table referred to by s.Tab. Let the set of the keys registered in the table be {Ge1, Ge2, ..., Gen}, then e.Domain has the form

     (Ge1)(Ge2) ... (Gen)

where the order of the keys depends on the Refal Plus implementation.

TableCopy creates a new table, copies into the new table the contents of the table referred to by s.Tab, and returns a reference to the new table.

ReplaceTable replaces the contents of the table referred to by s.TargetTable with a copy of the contents of the table referred to by s.SourceTable.