Rabu, 21 Oktober 2009

How to List All Combination Prolog

It is simple.. First create the database in notepad.. We use "makan" and "minum" clause.

Figure 2.1.

Save it into .pl extension


Figure 2.2

Then open the prolog, and consult the file..



Figure 2.3

To list all combination just type the queries, makan(X),minum(Y). Note it means give all posible makan and minum. (,) means "and". Don't forget to press semicolon (;) to view next combination.




Figure 2.4

Done.. Simple right? :)

Tidak ada komentar:

Posting Komentar