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)