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

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

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -