what is the issue with the following script?
want(grocerystore).
available(grocerystore).
want(X):-
available(X).
can(grocerystore):-
want(grocerystore),
\+work(walmart),
available(grocerystore).
what is the issue with the following script?
want(grocerystore).
available(grocerystore).
want(X):-
available(X).
can(grocerystore):-
want(grocerystore),
\+work(walmart),
available(grocerystore).
"Discontiguous predicate" means that you defined more than one clause for a given predicate, but defined the clause of a different predicate in between. Prolog wants all of the clauses of a given predicate together.
Here's an example of what properly defined Prolog looks like with multiple clauses for a given predicate or fact:
person(sally).
person(sue).
dog(fido).
dog(fluffy).
You can see all of the person facts are together, and all of the dog facts are together.
Here is an example of a "discontiguous predicate":
person(sally).
dog(fido).
person(sue).
dog(fluffy).
Here, the person facts are "interrupted" by a dog fact (and vice versa).
The same issue applies to predicates as it does to facts. In your case, two different want clauses are "interrupted" by the available fact:
want(grocerystore).
available(grocerystore). % 'available' clause occurs between two 'want' clauses
want(X) :- ...
Easy fix in this case:
available(grocerystore).
want(grocerystore).
want(X) :- ...
There may be other issues with your program, but I'm only addressing the question you have about "discontiguous predicate".