Predicates in this group are used to assign values to variables without unification, replacing their previous values. Variable assignment may be destructive [(:=)/2, (::=)/2] or back-trackable [(:==)/2, (::==)/2].
Destructive assignment is useful for setting object properties and temporary loop variables. Back-trackable assignment is recommended for use in code that is searching for a solution amongst alternatives so as to preserve logical consistency.
(:=)/2, (::=)/2, (:==)/2, (::==)/2
type_error(variable, Var)
- Var is not a variable. type_error(variable, Var)
- Var is a member variable reference but the member does not exist. X := f(a, b) succeeds
X := f(b, a) succeeds again, replacing the value
X := f(X, a) succeeds after renaming X to _X
X := Y + Z sets X to (_Y + _Z), does not evaluate
X := pi sets X to the atom pi, does not evaluate
X.name := 42 sets the name property of object X to 42
a := X type_error(variable, a)
type_error(variable, Var)
- Var is not a variable. type_error(variable, Var)
- Var is a member variable reference but the member does not exist.The errors for is/2 may also be thrown during the evaluation of Term.
X ::= X + 1 increments X X ::= pi sets X to 3.14159265358979323846 X.name ::= 48 - 6 sets the name property of object X to 42 a ::= X type_error(variable, a)
type_error(variable, Var)
- Var is not a variable. type_error(variable, Var)
- Var is a member variable reference but the member does not exist. X :== f(a, b) succeeds
X :== f(b, a) succeeds again, replacing the value
X :== f(X, a) fails due to occurs check
X :== Y + Z sets X to (Y + Z), does not evaluate
X :== pi sets X to the atom pi, does not evaluate
X.name :== 42 sets the name property of object X to 42
a :== X type_error(variable, a)
type_error(variable, Var)
- Var is not a variable. type_error(variable, Var)
- Var is a member variable reference but the member does not exist.The errors for is/2 may also be thrown during the evaluation of Term.
X ::== X + 1 X ::== pi X.name ::== 48 - 6 sets the name property of object X to 42 a ::== X type_error(variable, a)