小编use*_*896的帖子

Prolog是否使用Eager评估?

因为Prolog使用按时间顺序回溯(来自Prolog维基百科页面)甚至在找到答案后(在这个例子中只能有一个解决方案),这是否可以证明Prolog使用急切的评估?

mother_child(trude, sally).

father_child(tom, sally).
father_child(tom, erica).
father_child(mike, tom).

sibling(X, Y)      :- parent_child(Z, X), parent_child(Z, Y).

parent_child(X, Y) :- father_child(X, Y).
parent_child(X, Y) :- mother_child(X, Y).
Run Code Online (Sandbox Code Playgroud)

使用以下输出:

?- sibling(sally, erica).
true ;
false.
Run Code Online (Sandbox Code Playgroud)

prolog lazy-evaluation

7
推荐指数
2
解决办法
1243
查看次数

标签 统计

lazy-evaluation ×1

prolog ×1