?- assert(p(a)),assert(p(b)),setof(X,p(X),R).
X = H142
R = [a, b]
yes
Whats the effect of this query and why does it return this particular result?
The reason for the yes
result is that R, ie the set made of just a and b is effectively the set of all Xs that satisfy p(x) predicate.
If you were to add elements to R or to remove a or b from it, the result would be no
.
p(a) and p(b) are true because the assert predicates added these clauses to the database.
Similarly, keeping R = [a, b]
if you were to add another clause, with say assert(p(c))
, the result would be no
(because R would be missing c to have all X which satisfy p(X)).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.