3 ms·
Prolog also has syntax for if-then, so x(A, C), x(A, B), x(B, C); not(x(A, C)). can essentially be re-written as x(A, C) -> x(A, B), x(B, C); true.
by JadeNB 15y ago
Prolog also has syntax for if-then, so
x(A, C), x(A, B), x(B, C); not(x(A, C)).
can essentially be re-written as
x(A, C) -> x(A, B), x(B, C); true.
(This saves testing `x(A, C)` twice. Also, `->` implicitly cuts, presenting backtracking over `x(A, C)`; but that shouldn't matter here.) However, this set-up mistakenly has `x(A, C)` as the antecedent; I think you actually want it as the consequent.
- deleted 15y ago[deleted]