'How does the predicate i/4 function in Prolog
In "Representation and Inference for Natural Language - A First Course in Computational Semantics" by Blackburn and Bos they introduce the predicate i/4:
i(X,model(_,F),G,Value):-
(
var(X),
memberList(g(Y,Value),G),
Y==X, ! % IMPORTANT CUT!
;
atom(X),
memberList(f(0,X,Value),F)
).
They briefly mentioned that the predicate i/4 interprets terms using the variable
assignment g, if the term is a variable, and with the interpretation function F,
if it is a constant, but they do not address the "IMPORTANT CUT!" comment.
I don't understand what the funtion G represents and I also don't fully understand the importance of the line Y==X, !
I tried to run the code without the line Y==X, !,to figure out what it does, but it just gives me an error.
I also know that Y==X returns either 0 (when X != Y) or 1 (when X = Y),but I don't don't know what the , ! part is supposed to mean.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
