40. Hash Tables

A hash table is a collection of entries, where each entry consists of a key and a value. No two entries may have the same key. Given a key, a hash table can locate its entry very quickly and hence the associated value. Tcl contains a general-purpose hash table package that it uses in several places internally. For example, all of the commands in an interpreter are stored in a hash table where the key for each entry is a command name and the value is a pointer to information about the command. All of the variables in a namespace are stored in another hash table where the key for each entry is the name of a variable and the value is a pointer to information about the variable.

Tcl exports its hash table facilities through a set ...

Get Tcl and the Tk Toolkit, Second Edition 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.