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

Category: PrologCan you please explain With An Example What Is “setof” Predicate In Prolog?
Editor">Editor Staff asked 2 years ago

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

1 Answers
Editor">Editor Staff answered 2 years 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] ]