Getting the dictionary structure

In order to assist us with managing our dictionaries Tcl provides the dict info command. The syntax is as follows:

	dict info dictionaryValue

How to do it…

In the following example we will create a dictionary containing a key/value pair and then using the dict info command obtain information for our dictionary. Return values from the commands are provided for clarity. Enter the following command:

 % set names [dict create 1 John 2 Mary 3 Paul] 1 John 2 Mary 3 Paul % dict info $names 3 entries in table, 4 buckets number of buckets with 0 entries: 1 number of buckets with 1 entries: 3 number of buckets with 2 entries: 0 number of buckets with 3 entries: 0 number of buckets with 4 entries: 0 number of buckets with 5 ...

Get Tcl/Tk 8.5 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.