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

# tent_set(?X, +TV)

Set X's tentative value to TV

X
  Any term, typically a variable
TV
  A (nonvar) term

## Description

Give a variable (or several variables within a term) a tentative value. A tentative value cannot be itself a variable.

- If X is a variable without tentative value, it will be given the tentative value TV. In addition, its violatedness count will be initialised to 0.
- If X already has a tentative value, its tentative value is changed to TV. (Note that this may trigger further computation!) The violatedness count remains unchanged.
- If X is already instantiated, TV must be a strict instance of X. Variables within X are given tentative values from the corresponding instantiated parts of TV.

### Modes and Determinism

- tent_set(-, +) is det
- tent_set(+, +) is semidet

### Fail Conditions

TV is not an instance of X

### Exceptions

(4)
  TV is not sufficiently instantiated

## Examples

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

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

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

        ?- tent_set(X, Y).
        instantiation fault in X tent_set Y
        Abort

## See Also

tent_get / 2, has_tent_value / 1, tent_fix / 1