list - prolog delete head from a clause -
i using yap. suppose have scenario:
p(x,y) :- q(x), f(x,y), g(x).
i need put body of predicate in list using command listing(p).
expected output should be: [q,f,g].
how can that?
with 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 iso standard
Comments
Post a Comment