Node:CHR Built-In Predicates, Next:CHR Consulting and Compiling, Previous:CHR Options, Up:CHR Library
This table lists the predicates made available by the CHR library. They are meant for advanced users, who want to tailor the CHR system towards their specific needs.
current_handler(?Handler, ?Module)
Non-deterministically enumerates the defined handlers
with the module they are defined in.
current_constraint(?Handler, ?Constraint)
Non-deterministically enumerates the defined constraints
in the form Functor/Arity and the handlers they are
defined in.
insert_constraint(+Constraint, -Id)
Inserts Constraint into the constraint store
without executing any rules. The constraint will be woken and reconsidered
when one of the variables in Constraint is touched. Id is
unified with an internal object representing the constraint.
This predicate only gets defined when a handler and constraints are
declared (see CHR Declarations).
insert_constraint(+Constraint, -Id, ?Term)
Inserts Constraint into the constraint store without executing
any rules. The constraint will be woken and reconsidered when one of the
variables in Term is touched. Id is
unified with an internal object representing the constraint.
This predicate only gets defined when a handler and constraints are
declared (see CHR Declarations).
find_constraint(?Pattern, -Id)
Non-deterministically enumerates constraints from the constraint
store that match Pattern, i.e. which are instances of
Pattern. Id is
unified with an internal object representing the constraint.
find_constraint(-Var, ?Pattern, -Id)
Non-deterministically enumerates constraints from the constraint
store that delay on Var and match Pattern,
i.e. which are instances of
Pattern. The identifier Id can be used to
refer to the constraint later, e.g. for removal.
findall_constraints(?Pattern, ?List)
Unifies List with a list of Constraint # Id
pairs
from the constraint store that match Pattern.
findall_constraints(-Var, ?Pattern, ?List)
Unifies List with a list of Constraint # Id
pairs
from the constraint store that delay on Var and
match Pattern.
remove_constraint(+Id)
Removes the constraint Id, obtained with one of the previous predicates,
from the constraint store.
unconstrained(?Var)
Succeeds if no CHR constraint delays on Var. Defined as:
unconstrained(X) :- find_constraint(X, _, _), !, fail. unconstrained(_).
notify_constrained(?Var)
Leads to the reconsideration of the constraints associated with Var. This mechanism allows solvers to communicate reductions on the set of possible values of variables prior to making bindings.