Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LamentConfiguration/9af732ab102aa2e853af2dfc29cd9ab1 to your computer and use it in GitHub Desktop.
Save LamentConfiguration/9af732ab102aa2e853af2dfc29cd9ab1 to your computer and use it in GitHub Desktop.
Left recursion:
This arises when a rules causes the invocation of a goal that is essentially equivalent
to the original goal that caused the rule to be used.
This will recurse infinitely
person(adam).
person(X):-person(Y), mother(X,Y).
?-person(X).
This works (according to the book, either fails or something, but doesn't recurse infinitely)
person(X):-person(Y), mother(X,Y).
person(adam).
?-person(X).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment