Attributed Variables RuntimeAuthor(s): Rémy Haemmerlé, Christian Holzbaur, Daniel Cabeza, Manuel Carro.
This module provides a means to handle attributed variables. Note that attributes are private to the module from which the predicates implemented by attr_rt module are called. See package attr for more details about attributed variables.
Usage and interface
- Library usage:
Documentation on exports
Succeeds if Term is an attributed variable
If Var is a variable or attributed variable, set its attribute to Value. If an attribute is already associated with Var, the old value is replaced. Backtracking will restore the old value (i.e., an attribute is a mutable term. See also library mutables). This predicate raises a representation error if Var is not a variable and a type error if Module is not an atom.
Request the current value for the attribute associted to Var. If Var is not an attributed variable or the named attribute is not associated to Var this predicate fails silently.
If Var has an attribute, deletes it, otherwise succeeds without side-effect.
AttVars is a list of all attributed variables in Term and its attributes. I.e., attvarset/2 works recursively through attributes. This predicate is Cycle-safe. The goal term_attvars(Term,) is optimized to be an efficient test that Term has no attributes. I.e., scanning the term is aborted after the first attributed variable is found.
Creates a regular term Copy as a copy of Term (without any attributes), and a list Gs of goals that when executed reinstate all attributes onto Copy. The nonterminal attribute_goal/1, as defined in the modules the attributes stem from, is used to convert attributes to lists of goals.