Core Help Root: Objects: Trie


Trie is a datastructure that behaves like dictionary with string keys, except that it allows fast match_begin with all the keys. Also, key may be associated with a value list instead of a single value. Its memory overhead is about twice that of a dictionary, and all the operations are slower, except match_begin (which, unlike the dictionary's, does not have to loop through all the keys). Empty trie is represented as <$trie,[0,""]>.

Methods

.add(key, value[,value...])
Associate a list of values with a key.
.del(key)
Remove the key from trie.
.match_exact(key)
Find an exact match to the key.
.match_begin(key)
Find an approximate match.
.keys()
Get a list of the keys. This is very slow operation.
.to_dict(), $dictionary.to_trie(dict)
Conversions. The first one converts a trie with a single-element values into dictionary, reverse converts a dictionary with string keys to trie.


the Cold Dark