Search code examples
prologproblog

Why is there an error for the query: "query(member(one, [one,two,three]))." in Problog?


I am new to Problog / Prolog and am having trouble undertstanding why an error is happening during my query using the member function.

Any help would be much appreciated.

In Problog, I am attempting to query:

query(member(one, [one,two,three])).

which I expect to be true. But I get the error:

UnknownClause: No clauses found for 'member/2' at 189:7.

I am new to Problog / Prolog and am having trouble undertstanding why this is happening. Any help would be much appreciated.


Solution

  • I have defined a member function in my program:

        list_member(X,[X|_]).
    
        list_member(X,[_|TAIL]) :- 
            list_member(X,TAIL).
    

    and it now works. I had assumed the member function was already built in and would work. If anyone could confirm that there is no way of calling the member function without writing one in your own program that would be helpful.