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

tent_get(?X, -TV)

Get X's tentative value
X
Any term, typically a variable
TV
Will be bound to a (nonvar) term

Description

Get a variable's (or a whole term's) tentative value, i.e. create a term TV that represents the current tentative value of X.

Modes and Determinism

Exceptions

(tentative_value_not_set)
X (or a subterm of X) has no tentative value

Examples

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

    ?- tent_set(X, 27), tent_set(X, 99), tent_get(X, TV).
    X = X{99 -> 0}
    TV = 99
    Yes (0.00s cpu)

    ?- X = foo(Y), tent_set(X, foo(27)), X tent_get TV.
    X = foo(Y{27 -> 0})
    Y = Y{27 -> 0}
    TV = foo(27)
    Yes (0.00s cpu)

    ?- tent_get(27, TV).
    TV = 27
    Yes (0.00s cpu)

    ?- tent_get(X, TV).
    uncaught exception in exit_block(tentative_value_not_set)
    Abort

    ?- tent_get(foo(X), TV).
    uncaught exception in exit_block(tentative_value_not_set)
    Abort
    

See Also

tent_set / 2, has_tent_value / 1, tent_fix / 1