Author(s): Christian Holzbaur, Daniel Cabeza, Manuel Carro.
Version: 1.10#7 (2006/4/26, 19:22:13 CEST)
Version of last change: 1.5#157 (2000/5/30, 13:4:47 CEST)
These predicates allow the manipulation of attributed variables. Attributes are special terms which are attached to a (free) variable, and are hidden from the normal Prolog computation. They can only be treated by using the predicates below.
attributes
)attributes
)
Usage: attach_attribute(Var, Attr)
Attr
to Var
.
Var
is a free variable.
(term_typing:var/1
)
Attr
is currently a term which is not a free variable.
(term_typing:nonvar/1
)
Usage: get_attribute(Var, Attr)
Attr
with the attribute of Var
, or fail if Var
has no attribute.
Var
is a free variable.
(term_typing:var/1
)
Attr
is currently a term which is not a free variable.
(term_typing:nonvar/1
)
Usage: update_attribute(Var, Attr)
Var
to Attr
.
Var
is a free variable.
(term_typing:var/1
)
Attr
is currently a term which is not a free variable.
(term_typing:nonvar/1
)
Usage: detach_attribute(Var)
Var
.
Var
is a free variable.
(term_typing:var/1
)
attributes
)The predicate is multifile.
Usage: verify_attribute(Attr, Term)
Attr
is about to be unified with the non-variable term Term
. The user should define this predicate (as multifile) in the modules implementing special unification.
Attr
is currently a term which is not a free variable.
(term_typing:nonvar/1
)
Term
is currently a term which is not a free variable.
(term_typing:nonvar/1
)
The predicate is multifile.
Usage: combine_attributes(Var1, Var2)
Var1
and Var2
are about to be unified. The user should define this predicate (as multifile) in the modules implementing special unification.
Var1
is a free variable.
(term_typing:var/1
)
Var2
is a free variable.
(term_typing:var/1
)
attributes
)
Note that
combine_attributes/2
and
verify_attribute/2
are not called with the attributed variables involved, but with the corresponding attributes instead. The reasons are:
freeze/2
utilizes this technique. Note that this does not lead to cyclic structures, as the connection between an attributed variable and its attribute is invisible to the pure parts of the Prolog implementation.
get_attribute/2
.
However, future improvements may change or extend the interface to attributed variables in order to provide a richer and more expressive interface.
For customized output of attributed variables, please refer to the documentation of the predicate
portray_attribute/2
.
Go to the first, previous, next, last section, table of contents.