KEYED LISTS
Extended Tcl defines a special type of list referred to as
keyed lists. These lists provided a structured data type
built upon standard Tcl lists. This provides a function-
ality similar to structs in the C programming language.
A keyed list is a list in which each element contains a
key and value pair. These element pairs are stored as
lists themselves, where the key is the first element of
the list, and the value is the second. The key-value
pairs are referred to as fields. This is an example of a
keyed list:
{{NAME {Frank Zappa}} {JOB {musician and com-
poser}}}
If the variable person contained the above list, then
keylget person NAME would return {Frank Zappa}. Executing
the command:
keylset person ID 106
would make person contain
{{ID 106} {NAME {Frank Zappa}} {JOB {musician
and composer}}
Fields may contain subfields; `.' is the separator charac-
ter. Subfields are actually fields where the value is
another keyed list. Thus the following list has the top
level fields ID and NAME, and subfields NAME.FIRST and
NAME.LAST:
{ID 106} {NAME {{FIRST Frank} {LAST Zappa}}}
There is no limit to the recursive depth of subfields,
allowing one to build complex data structures.
Keyed lists are constructed and accessed via a number of
commands. All keyed list management commands take the
name of the variable containing the keyed list as an argu-
ment (i.e. passed by reference), rather than passing the
list directly.
This functionality is provided by Extended Tcl.