http://www.perlmonks.org?node_id=479621


in reply to (OT) Pushing inductive systems to their limit

Ovid, in prolog, attributed variables is what you are looking for.

Attributed variables are unbound variables but with a set of conditions or attributes attached. When an attributed variable is unified with anything else, its attached attributes (that are effectively callback predicates) are called, and their success or failure determines also the success or failure of the unification.

Most free prolog implementations (SWI-Prolog, YAP, XSB ) support them (unfortunately Language::Prolog::Yaswi doesn't), and it should be too difficult to extend AI::Prolog to also do so.

Attributed variables are mostly used in prolog to implement constraint logic programing (CLP). A good introduction to CLP is available on Bratko's Prolog Programing for Artificial Intelligence.