Chapter 6. The Tcl Dictionary
In this chapter, we will cover the following topics:
Creating a dictionary
Appending to a dictionary
Determining if a key exists
Filtering a dictionary
Searching a dictionary
Getting a record
Incrementing a value
Getting the dictionary structure
Getting a list of keys
Appending to an existing record
Merging two dictionaries
Create a blank dictionary structure
Updating variables from a dictionary
Determining the size of a dictionary
Getting all records
Assigning values
Introduction
Strings hold textual data from a single character to a large text file. Lists allow us to store groups of strings and lists in an organized manner. But neither offers a simple method for relating data elements to a key value, in the manner of an array or database. If you need to organize multiple items under a single group, nothing beats a dictionary.
Dictionary allows storage of data with a key/value mapping methodology, with each key in the dictionary mapping to a single value. Dictionaries are...