[ 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. 
	
    	- If X is a tentative variable, TV is bound to the tentative value.
- If X is a variable without tentative value, an error is raised.
- If X is atomic, its tentative value is the same as X.
- If X is a compound term, TV will be bound to a corresponding compound
	term with all variables replaced by their tentative values. The resulting
	term TV will be a proper instance 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