[ library(tentative) | Reference Manual | Alphabetic Index ]

?Result tent_is +Expr

Maintain tentative result of arithmetic expression
A (free or tentative) variable
Arithmetic expression containing tentative variables


Implementation of arithemtic invariants.

This is similar to the normal arithmetic is/2 predicate, but evaluates the expression based on the tentative values of its variables. The result is delivered as (an update to) the tentative value of the Result variable. Once initiated, tent_is will stay active and keep updating Result's tentative value eagerly whenever the tentative value of any variable in Expression changes.

Modes and Determinism


This predicate is sensitive to its module context (tool predicate, see @/2).


    ?- [X, Y] tent_set [3, 4], Z tent_is X + Y.
    X = X{3 -> 0}
    Y = Y{4 -> 0}
    Z = Z{7 -> 0}
    Yes (0.00s cpu)

    ?- [X, Y] tent_set [3, 4], Z tent_is X + Y, X tent_set 7.
    X = X{7 -> 0}
    Y = Y{4 -> 0}
    Z = Z{11 -> 0}
    Yes (0.00s cpu)

See Also

tent_set / 2, tent_get / 2