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

var_get_violations(?X, -Violations)

Get X's violation count
X
A a tentative variable or instantiated term
Violations
Variable, will be bound to a number

Description

Get X's violations count. The violation count of a tentative variable is the cumulative result of all previous increments of that count. The violation count of a nonvariable term is 0.

Modes and Determinism

Exceptions

(tentative_value_not_set)
X is a variable without tentative value

Examples

    ?- tent_set(X, 27), var_get_violations(X, V).
    X = X{27 -> 0}
    V = 0
    Yes (0.00s cpu)

    ?- tent_set(X, 27), var_inc_violations(X, 3), var_get_violations(X, V).
    X = X{27 -> 3}
    V = 3
    Yes (0.00s cpu)

    ?- var_get_violations(a, V).
    V = 0
    Yes (0.00s cpu)

    ?- var_get_violations(_, V).
    uncaught exception in throw(tentative_value_not_set)
    Abort
    

See Also

tent_set / 2, var_inc_violations / 2