Satisfying a Unary Prolog predicate -



Satisfying a Unary Prolog predicate -

in order write procedure satisfy(p,l) returns list l of terms x such unary predicate p(x) succeeds. have attempted following:

satisfy(p,l):- findall(x,call(p(x)),l).

am on right track or have gone off?

you can using builtin predicate call/2:

satisfy(p, l):- findall(x, call(p, x), l).

prolog

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -