All these discussions of "=" are missing the point.
The notation "x = x + 1" is awful because at lhs x denotes a reference to an integer while at rhs x denotes the value hold by the reference. If you know C, it is similar to the difference between an integer pointer *x and an integer x. As an illustration, here are two programs that are doing the same thing, one in C and one in Haskell.
#include <stdio.h>
int main() {
int x = 0;
x = x + 1;
printf("%d\n", x);
return 0;
}
import Data.IORef
main :: IO ()
main = do
xref <- newIORef 0
x1 <- readIORef xref
writeIORef xref (x1 + 1)
x2 <- readIORef xref
print x2
We don't have such problem in Prolog. In prolog X can never be equal to X+1. X will always be X. Once X has a value, it never changes. One of the thing that gives most procedural programmers a headache.
The notation "x = x + 1" is awful because at lhs x denotes a reference to an integer while at rhs x denotes the value hold by the reference. If you know C, it is similar to the difference between an integer pointer *x and an integer x. As an illustration, here are two programs that are doing the same thing, one in C and one in Haskell.