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
Post a Comment