Hacker News new | ask | show | jobs
by jimwise 5426 days ago
though be careful how you do this -- it's easy to end up with a divergent program, as prolog tries to:

* prove X(A,B)

* realizes that it can prove this if it can prove transitive(X, A, B, C), and then prove X(B,A)

* realizes that it can prove this if it can prove transitive(X, B, A, C), and then prove X(A,B)

* ...

1 comments

Such behavior is easily avoided with tabling.
There are a couple of ways around this -- all of which fall under "be careful". :-)