I have the following Prolog rule that allows the user to input three values and assert a Fact from those values:
我有以下Prolog规则,允许用户输入三个值并从这些值断言事实:
input(X,Y,Z) :- Fact = ves(X,Y,Z), assertz(Fact).
How would I now be able to print out the values of the 'ves' Fact? I tried this, however I receive a singleton error for X,Y and Z. I would like the 'checkCap' rule to print the values of 'ves'.
我现在如何能够打印出'ves'事实的价值?我试过这个,但是我收到了X,Y和Z的单例错误。我希望'checkCap'规则打印'ves'的值。
checkCap :- writeln(ves(X,Y,Z)).
1 个解决方案
#1
Maybe this helps:
也许这有助于:
checkCap :-
ves(X,Y,Z), % look up dynamic database
write(ves(X,Y,Z)), % write out term
nl.
#1
Maybe this helps:
也许这有助于:
checkCap :-
ves(X,Y,Z), % look up dynamic database
write(ves(X,Y,Z)), % write out term
nl.