Can you please explain With An Example What Is “setof” Predicate In Prolog?

DWQA QuestionsCategory: PrologCan you please explain With An Example What Is “setof” Predicate In Prolog?
Editor Staff asked 10 months ago

Can you please explain With An Example What Is “setof” Predicate In Prolog?

1 Answers
Editor Staff answered 10 months ago

In Prolog, “Setof” predicate can be used to find out all the solutions of a predicate. For example, you have this database:
Wisdom (SAP, Testing Tools)
Wisdom (PHP, Perl)
And if you want to find the solutions of Wisdom(X, Y). We can enter
Setof ([ X,Y] ,Wisdom (X,Y), Z).
Z = [[ SAP , Testing Tools], [ PHP, Perl] ]