![]() |
YAP 7.1.0
|
The following association list manipulation predicates are available once included with the use_module(library(assoc))
command.
More...
The following association list manipulation predicates are available once included with the use_module(library(assoc))
command.
The original library used Richard O'Keefe's implementation, on top of unbalanced binary trees The current code utilises code from the red-black trees library and emulates the SICStus Prolog interface
The library exports the following definitions:
class empty_assoc/1 |
empty_assoc(+ Assoc)
Succeeds if association list Assoc is empty
class assoc_to_list/2 |
assoc_to_list(+ Assoc,? List)
Given an association list Assoc unify List with a list of the form Key-Val, where the elements Key are in ascending order
class is_assoc/1 |
is_assoc(+ Assoc)
Succeeds if Assoc is an association list, that is, if it is a red-black tree
class min_assoc/3 |
min_assoc(+ Assoc,- Key,? Value)
Given the association list Assoc, Key in the smallest key in the list, and Value the associated value
class max_assoc/3 |
max_assoc(+ Assoc,- Key,? Value)
Given the association list Assoc, Key in the largest key in the list, and Value the associated value
class gen_assoc/3 |
gen_assoc( ?Key, +Assoc, ?Valu_)
Given the association list Assoc, unify Key and Value with a key-value pair in the list It can be used to enumerate all elements in the association list
class get_assoc/3 |
get_assoc(+ Key,+ Assoc,? Value)
If Key is one of the elements in the association list Assoc, return the associated value
class get_assoc/5 |
get_assoc(+ Key,+ Assoc,? Value,+ NAssoc,? NValue)
If Key is one of the elements in the association list Assoc, return the associated value Value and a new association list NAssoc where Key is associated with NValue
class get_next_assoc/4 |
get_next_assoc(+ Key,+ Assoc,? Next,? Value)
If Key is one of the elements in the association list Assoc, return the next key, Next, and its value, Value
class get_prev_assoc/4 |
get_prev_assoc(+ Key,+ Assoc,? Next,? Value)
If Key is one of the elements in the association list Assoc, return the previous key, Next, and its value, Value
class list_to_assoc/2 |
list_to_assoc(+ List,? Assoc)
Given a list List such that each element of List is of the form Key-Val, and all the Keys are unique, Assoc is the corresponding association list
class ord_list_to_assoc/2 |
ord_list_to_assoc(+ List,? Assoc)
Given an ordered list List such that each element of List is of the form Key-Val, and all the Keys are unique, Assoc is the corresponding association list
class map_assoc/2 |
map_assoc(+ Pred,+ Assoc)
Succeeds if the unary predicate name Pred( Val) holds for every element in the association list
class map_assoc/3 |
map_assoc(+ Pred,+ Assoc,? New)
Given the binary predicate name Pred and the association list Assoc, New in an association list with keys in Assoc, and such that if Key-Val is in Assoc, and Key-Ans is in New, then Pred( Val, Ans) holds
class put_assoc/4 |
put_assoc(+ Key,+ Assoc,+ Val,+ New)
The association list New includes and element of association key with Val, and all elements of Assoc that did not have key Key
class del_assoc/4 |
del_assoc(+ Key, + Assoc, ? Val, ? NewAssoc)
Succeeds if NewAssoc is an association list, obtained by removing the element with Key and Val from the list Assoc
class del_min_assoc/4 |
del_min_assoc(+ Assoc, ? Key, ? Val, ? NewAssoc)
Succeeds if NewAssoc is an association list, obtained by removing the smallest element of the list, with Key and Val from the list Assoc
class del_max_assoc/4 |
del_max_assoc(+ Assoc, ? Key, ? Val, ? NewAssoc)
Succeeds if NewAssoc is an association list, obtained by removing the largest element of the list, with Key and Val from the list Assoc