object
trie(Representation)
Representation- String representation. Valid values areatom,codes, andchars.
Persistent trie predicates supporting different string representations.
logtalk_load(tries(loader))static, context_switching_callsPublic predicates
new/1
Creates an empty trie.
staticnew(Trie)new(-trie) - oneas_trie/2
Converts a list of string-value pairs to a trie. When a string occurs multiple times, the last value is retained.
staticas_trie(Pairs,Trie)as_trie(@list(pairs),-trie) - oneas_list/2
Converts a trie to a lexicographically ordered list of string-value pairs.
staticas_list(Trie,Pairs)as_list(@trie,-list(pairs)) - oneas_list/3
Returns a lexicographically ordered list of all string-value pairs whose strings start with the given prefix. Fails if no string starts with the prefix.
staticas_list(Trie,Prefix,Pairs)as_list(@trie,+text,-list(pairs)) - zero_or_onestrings/2
Returns all strings in a trie in lexicographic order.
staticstrings(Trie,Strings)strings(@trie,-list(text)) - onestrings/3
Returns all strings that start with the given prefix in lexicographic order. Fails if no string starts with the prefix.
staticstrings(Trie,Prefix,Strings)strings(@trie,+text,-list(text)) - zero_or_onevalues/2
Returns all values in lexicographic order of their associated strings.
staticvalues(Trie,Values)values(@trie,-list) - onevalues/3
Returns all values associated with strings that start with the given prefix, in lexicographic order of the strings. Fails if no string starts with the prefix.
staticvalues(Trie,Prefix,Values)values(@trie,+text,-list) - zero_or_oneempty/1
True iff the trie is empty.
staticempty(Trie)empty(@trie) - zero_or_oneinsert/4
Inserts a string-value pair into a trie, returning the updated trie. When the string already exists, its associated value is updated.
staticinsert(OldTrie,String,Value,NewTrie)insert(+trie,+text,@term,-trie) - onelookup/3
Looks up a matching string-value pair. With an unbound string, enumerates all pairs in lexicographic order.
staticlookup(String,Value,Trie)lookup(+text,?term,@trie) - zero_or_onelookup(-text,?term,@trie) - zero_or_moreupdate/4
Updates the value associated with a string, returning the updated trie. Fails if the string is not stored.
staticupdate(OldTrie,String,NewValue,NewTrie)update(+trie,+text,+term,-trie) - zero_or_oneupdate/5
Updates the value associated with a string, returning the updated trie. Fails if the string is not stored or its value does not unify with the expected old value.
staticupdate(OldTrie,String,OldValue,NewValue,NewTrie)update(+trie,+text,?term,+term,-trie) - zero_or_onedelete/4
Deletes a matching string-value pair, returning the updated trie. Descendant strings are preserved.
staticdelete(OldTrie,String,Value,NewTrie)delete(+trie,+text,?term,-trie) - zero_or_onelookup_prefix/4
Enumerates all string-value pairs whose strings start with the given prefix, in lexicographic order.
staticlookup_prefix(Prefix,String,Value,Trie)lookup_prefix(+text,-text,?term,@trie) - zero_or_moreprefixes/3
Returns all stored string-value pairs whose strings are prefixes of the query, ordered from shortest to longest.
staticprefixes(Trie,Query,Pairs)prefixes(@trie,+text,-list(pairs)) - onelongest_prefix/4
Returns the longest stored string that is a prefix of the query and its associated value. Fails if no stored string is a prefix.
staticlongest_prefix(Trie,Query,Prefix,Value)longest_prefix(@trie,+text,-text,-term) - zero_or_onedelete_prefix/3
Deletes all string-value pairs whose strings start with the given prefix, returning the updated trie. Fails if no string starts with the prefix.
staticdelete_prefix(OldTrie,Prefix,NewTrie)delete_prefix(+trie,+text,-trie) - zero_or_onesize/2
Number of string-value pairs stored in a trie.
staticsize(Trie,Size)size(@trie,?integer) - oneProtected predicates
(no local declarations; see entity ancestors if any)
Private predicates
(no local declarations; see entity ancestors if any)
Operators
(none)