BinaryRelation
Base class to implement primitives that relate two Terms and provide a single response, sparing implementers from manually pulling first/second out of Solve.Request.arguments and checking the request's arity (always 2, enforced by PrimitiveWrapper).
This class and its nested subclasses form a ladder of increasingly specific (and increasingly convenient) template methods to override, from most to least general:
BinaryRelation itself -- override computeAll for a fully backtrackable relation producing arbitrarily many Solve.Responses (including side effects), e.g. via Solve.Request.replyWith;
WithoutSideEffects -- override
computeAllSubstitutionsfor a backtrackable relation with no side effects, producing a Sequence of Substitutions (one per solution);NonBacktrackable -- override
computeOnefor a deterministic relation (no choice points) still able to attach side effects to its single Solve.Response;Functional -- override
computeOneSubstitutionfor a deterministic, side-effect-free relation producing a single Substitution;Predicative -- override
computefor a deterministic, pure test returningtrue/false(e.g.==/2).
See the it.unibo.tuprolog.solve.stdlib.primitive implementations (e.g. arithmetic comparisons) for concrete examples of each level.
Inheritors
Types
A NonBacktrackable that only needs to produce a single Substitution, without custom side effects.
A BinaryRelation known to be deterministic, i.e. producing exactly one Solve.Response (no choice points).
A NonBacktrackable that is a pure success/failure test, with no substitution nor side effects.
A BinaryRelation that only needs to produce the Substitutions for each solution, without custom side effects.
Properties
Gets this wrapped primitive description Pair formed by signature and wrapped primitive type
Checked primitive implementation