开发者

variables in Prolog

I n开发者_运维知识库eed to create a family relationship using Prolog. I installed SWI Prolog on my laptop, and create a file with two variables just to get familiar with Prolog. I did consult to import the file and thought I was good to go. However, when i tried to access the file, (for example: fname(x).) instead of returning the content on the fact, it's returning "true".


Variable names in Prolog start with an uppercase letter. If your file contains

fname(adam).
fname(eve).

then you can call fname as follows:

?- fname(X).
X = adam ;
X = eve.

Note: the semicolon (;) is user input.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜