I am using yap. Suppose I have this scenario:
p(x,y) :- q(x), f(x,y), g(x).
I need to put the body of the predicate in a list using the command listing(p).
Expected output should be: [q,f,g].
How I can do that?
with a service predicate
enum_conj((A, B),X) :- !, (enum_conj(A, X) ; enum_conj(B, X)). enum_conj(X, X).
we can do
?- clause(p(_, _), P), setof(F, J^A^(enum_conj(P, J), functor(J, F, A)), L). L = [f,g,q], P = (q(x),f(x,y),g(x))
all builtins used are ISO standard
with a service predicate
we can do
all builtins used are ISO standard