8.1 Attributed variables
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Constraint Logic Programming
        • Attributed variables
          • Attribute manipulation predicates
            • attvar/1
            • put_attr/3
            • get_attr/3
            • del_attr/2
          • Attributed variable hooks
          • Operations on terms with attributed variables
          • Special purpose predicates for attributes
    • Packages

8.1.1 Attribute manipulation predicates

attvar(@Term)
Succeeds if Term is an attributed variable. Note that var/1 also succeeds on attributed variables. Attributed variables are created with put_attr/3.
put_attr(+Var, +Module, +Value)
If Var is a variable or attributed variable, set the value for the attribute named Module to Value. If an attribute with this name 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 setarg/3). This predicate raises an uninstantiation error if Var is not a variable, and a type error if Module is not an atom.
get_attr(+Var, +Module, -Value)
Request the current value for the attribute named Module. If Var is not an attributed variable or the named attribute is not associated to Var this predicate fails silently. If Module is not an atom, a type error is raised.
del_attr(+Var, +Module)
Delete the named attribute. If Var loses its last attribute it is transformed back into a traditional Prolog variable. If Module is not an atom, a type error is raised. In all other cases this predicate succeeds regardless of whether or not the named attribute is present.