?- 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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The reason for the
yesresult is that R, i.e. 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 sayassert(p(c)), the result would beno(because R would be missing c to have all X which satisfy p(X)).