1.

Explain With An Example What Is “setof” Predicate In Prolog?

Answer»

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] ]

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] ]



Discussion

No Comment Found