protocol
dictionaryp¶
Dictionary protocol.
staticPublic predicates¶
as_dictionary/2¶
Converts a list of key-value pairs to a dictionary.
staticas_dictionary(Pairs,Dictionary)as_dictionary(@list(pairs),-dictionary) - oneas_list/2¶
Converts a dictionary to an ordered list (as per standard order) of key-value pairs.
staticas_list(Dictionary,Pairs)as_list(@dictionary,-list(pairs)) - oneas_curly_bracketed/2¶
Creates a curly-bracketed term representation of a dictionary.
staticas_curly_bracketed(Dictionary,Term)as_curly_bracketed(+dictionary,--term) - oneclone/3¶
Clones a dictionary using the same keys but with all values unbound and returning a list of all the pairs in the new clone.
staticclone(Dictionary,Clone,ClonePairs)clone(+dictionary,-dictionary,-list(pairs)) - oneclone/4¶
Clones a dictionary using the same keys but with all values unbound and returning the list of all pairs in the dictionary and in the clone.
staticclone(Dictionary,Pairs,Clone,ClonePairs)clone(+dictionary,-list(pairs),-dictionary,-list(pairs)) - oneinsert/4¶
Inserts a key-value pair into a dictionary, returning the updated dictionary. When the key already exists, the associated value is updated.
staticinsert(OldDictionary,Key,Value,NewDictionary)insert(+dictionary,+ground,@term,-dictionary) - onedelete/4¶
Deletes a matching key-value pair from a dictionary, returning the updated dictionary.
staticdelete(OldDictionary,Key,Value,NewDictionary)delete(+dictionary,@ground,?term,-dictionary) - zero_or_oneupdate/4¶
Updates the value associated with Key in a dictionary, returning the updated dictionary. Fails if it cannot find the key.
staticupdate(OldDictionary,Key,NewValue,NewDictionary)update(+dictionary,@ground,+term,-dictionary) - zero_or_oneupdate/5¶
Updates the value associated with a key in a dictionary, returning the updated dictionary. Fails if it cannot find the key or if the existing value does not match the old value.
staticupdate(OldDictionary,Key,OldValue,NewValue,NewDictionary)update(+dictionary,@ground,?term,+term,-dictionary) - zero_or_oneupdate/3¶
Updates the key-value pairs in a dictionary, returning the updated dictionary. Fails if it cannot find one of the keys.
staticupdate(OldDictionary,Pairs,NewDictionary)update(+dictionary,@list(pair),-dictionary) - zero_or_oneempty/1¶
True iff the dictionary is empty.
staticempty(Dictionary)empty(@dictionary) - zero_or_onelookup/3¶
Lookups a matching key-value pair from a dictionary.
staticlookup(Key,Value,Dictionary)lookup(+ground,?term,@dictionary) - zero_or_onelookup(-ground,?term,@dictionary) - zero_or_morelookup/2¶
Lookups all matching key-value pairs from a dictionary. Fails if it cannot find one of the keys or if a value for a key does not unify.
staticlookup(Pairs,Dictionary)lookup(+list(pair),@dictionary) - zero_or_oneintersection/2¶
True iff the values of the dictionaries common keys unify. Trivially true when there are no common keys.
staticintersection(Dictionary1,Dictionary2)intersection(+dictionary,+dictionary) - zero_or_oneintersection/3¶
Returns the (possibly empty) intersection between two dictionaries when the values of their common keys unify.
staticintersection(Dictionary1,Dictionary2,Intersection)intersection(+dictionary,+dictionary,-dictionary) - zero_or_oneprevious/4¶
Returns the previous pair in a dictionary given a key.
staticprevious(Dictionary,Key,Previous,Value)previous(+dictionary,+key,-key,-value) - zero_or_onenext/4¶
Returns the next pair in a dictionary given a key.
staticnext(Dictionary,Key,Next,Value)next(+dictionary,+key,-key,-value) - zero_or_onemin/3¶
Returns the pair with the minimum key (as per standard order) in a dictionary. Fails if the dictionary is empty.
staticmin(Dictionary,Key,Value)min(+dictionary,-key,-value) - zero_or_onemax/3¶
Returns the pair with the maximum key (as per standard order) in a dictionary. Fails if the dictionary is empty.
staticmax(Dictionary,Key,Value)max(+dictionary,-key,-value) - zero_or_onedelete_min/4¶
Deletes the pair with the minimum key (as per standard order) from a dictionary, returning the deleted pair and the updated dictionary.
staticdelete_min(OldDictionary,Key,Value,NewDictionary)delete_min(+dictionary,-key,-value,-dictionary) - zero_or_onedelete_max/4¶
Deletes the pair with the maximum key (as per standard order) from a dictionary, returning the deleted pair and the updated dictionary.
staticdelete_max(OldDictionary,Key,Value,NewDictionary)delete_max(+dictionary,-key,-value,-dictionary) - zero_or_onekeys/2¶
Returns a list with all the dictionary keys in ascending order (as per standard order).
statickeys(Dictionary,Keys)keys(@dictionary,-list) - onevalues/2¶
Returns a list with all the dictionary values in ascending order of the keys (as per standard order).
staticvalues(Dictionary,Values)values(@dictionary,-list) - onemap/2¶
Maps a closure over each dictionary key-value pair. Fails if the mapped closure attempts to modify the keys.
staticmap(Closure,Dictionary)map(1,*)map(@callable,+dictionary) - zero_or_moremap/3¶
Maps a closure over each dictionary key-value pair, returning the new dictionary. Fails if the mapped closure attempts to modify the keys.
staticmap(Closure,OldDictionary,NewDictionary)map(2,*,*)map(@callable,+dictionary,-dictionary) - zero_or_moreapply/4¶
Applies a closure to a specific key-value pair, returning the new dictionary. Fails if the key cannot be found or if the mapped closure attempts to modify the key.
staticapply(Closure,OldDictionary,Key,NewDictionary)apply(2,*,*,*)apply(+callable,+dictionary,+key,-dictionary) - zero_or_oneProtected predicates¶
(none)
Private predicates¶
(none)