取一个给定的数据库,例如
input(80).
input(30).
input(25).
input(90).
计算超过 50 乘以 100 的输入量,限制为仅采用 /1 输入。例如
%compute(?integer).
compute(I).
I = 200 %seeing as input(80) and input(90) matches the condition of being above 50
我尝试了以下序言代码来模仿计算功能,但未成功:
compute(I) :- input(G), G>50, I is I+100.
I+100 没有按我的意愿工作。