UnknownClause: No clauses found for 'forall/2'

Hello,

In my SWI-Prolog installation, it seems that I cannot run “forall” clauses.
I’m using: SWI-Prolog version 2.1.0.39 on MacOS High Sierra (10.13.2)

I’ve obtained this error in various cases. For example, in next simple code:

:- use_module(library(lists)).

action(N,M):-
        node(N),
        node(M),
        forall(path(N,P), last(M,P)).

last(X,[X]).
last(X,[_|Z]) :- last(X,Z).


node(n1).
node(n2).
node(n3).
node(n4).
path(n1, [n2, n1, n3]).
path(n1, [n3, n1, n4]).

query(action(n1,M)).

But what I’m getting is:
UnknownClause: No clauses found for ‘forall/2’ at 6:9.

What I can be doing wrong?
Best,
Isaac

Version SWI-Prolog version 2.1.0.39?!? Are you sure?

:slight_smile:

@wisaaco Can you run something like swipl --version on your machine? This is what I see:

$ swipl --version
SWI-Prolog version 8.1.17 for x86_64-linux

It might be that your installation is somehow botched. It is also not clear at all how you load the code, how you run it and so on. If I put your code in a file called foo.pl, I for example get the following:

$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.17-8-g2276d5765)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- [foo].
Warning: foo.pl:8:
Warning:    Local definition of user:last/2 overrides weak import from lists
Warning: foo.pl:19:
Warning:    Singleton variables: [M]
true.

?- action(n1, M).
false.

in other words, you have all kinds of other problems and it isn’t even clear what you are doing.

Doesn’t look like a message from SWI-Prolog. I think you have some other Prolog.

I’m sorry, I was running my rules in Problog version instead of SWI.
In SWI, it works. So sorry for open this issue here.