diff options
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -19455,6 +19455,36 @@ function instead. | |||
19455 | In addition to storing key-value pairs, a hash table can have a piece of | 19455 | In addition to storing key-value pairs, a hash table can have a piece of |
19456 | information associated with it, called the user data. | 19456 | information associated with it, called the user data. |
19457 | 19457 | ||
19458 | A hash table can be traversed to visit all of the keys and data. The order of | ||
19459 | traversal bears no relation to the order of insertion, or to any properties of | ||
19460 | the key type. | ||
19461 | |||
19462 | During an open traversal, new keys can be inserted into a hash table or deleted | ||
19463 | from it while a a traversal is in progress. Insertion of a new key during | ||
19464 | traversal will not cause any existing key to be visited twice or to be skipped; | ||
19465 | however, it is not specified whether the new key will be traversed. Similarly, | ||
19466 | if a key is deleted during traversal, and that key has not yet been visited, it | ||
19467 | is not specified whether it will be visited during the remainder of the | ||
19468 | traversal. | ||
19469 | |||
19470 | An open traversal of a hash table is performed by the | ||
19471 | .code maphash | ||
19472 | function and the | ||
19473 | .code dohash | ||
19474 | operator. The traversal is open because code supplied by the program | ||
19475 | is evaluated for each entry. | ||
19476 | |||
19477 | The functions | ||
19478 | .codn hash-keys , | ||
19479 | .codn hash-values , | ||
19480 | .codn hash-pairs , | ||
19481 | and | ||
19482 | .code hash-alist also perform an open traversal, because they return | ||
19483 | lazy lists. The traversal isn't complete until the returned lazy list | ||
19484 | is fully instantiated. In the meanwhile, the | ||
19485 | \*(TX program can mutate the hash table from which the lazy list | ||
19486 | is being generated. | ||
19487 | |||
19458 | .coNP Function @ hash-construct | 19488 | .coNP Function @ hash-construct |
19459 | .synb | 19489 | .synb |
19460 | .mets (hash-construct < hash-args << key-val-pairs ) | 19490 | .mets (hash-construct < hash-args << key-val-pairs ) |
@@ -19888,6 +19918,9 @@ then the corresponding entries from | |||
19888 | each list pairwise correspond to the pairs in | 19918 | each list pairwise correspond to the pairs in |
19889 | .metn hash . | 19919 | .metn hash . |
19890 | 19920 | ||
19921 | The list returned by each of these functions is lazy, and hence constitutes | ||
19922 | an open traversal of the hash table. | ||
19923 | |||
19891 | .coNP Operator @ dohash | 19924 | .coNP Operator @ dohash |
19892 | .synb | 19925 | .synb |
19893 | .mets (dohash ( < key-var < value-var < hash-form <> [ result-form ]) | 19926 | .mets (dohash ( < key-var < value-var < hash-form <> [ result-form ]) |