If you ask tuProlog to solve the following goal:
?- Y = (write(3), nl, 3), call(Y).
you get "no." as an answer, rightly so because 3 is not callable (or, in
ISO parlance, the term 3 cannot be converted to a goal).
However, if you use an "intermediate" variable to "store" (really, bind)
the term 3, you get a different result:
?- X = 3, Y = (write(X), nl, X), call(Y).
3
no.
That is, you still get the right answer, but this time 3 gets printed. This
should not happen, because the term-to-goal conversion algorithm has to
deeply traverse variables in order to check if certain kinds of term (a
conjunction, in this case) are callable or not.
Nobody/Anonymous
Core
v2.1
Public