Previous Up Next

17.4 Creating Attributed Variables

The usual way to create an attributed variable (or to add an attribute to a variable) is by using the tool predicate

add_attribute(Var, Attr).

An attribute whose name is not the current module name can be added using

add_attribute(Var, Attr, Name).

If Var is a free variable, it will be bound to a new attributed variable whose attribute corresponding to the current module is Attr and all its other attributes are free variables. If Var is already an attributed variable and its attribute is uninstantiated, it will be bound to Attr, otherwise the effect of this predicate will be the same as unifying Var with another attributed variable whose attribute corresponding to the current module is Attr.


Previous Up Next