
On this first post, we will give a tutorial using the Prolog (Programming Logic) Language. The title of this post is "How to Make All Possible Combination of 2 Sets with Prolog". From the title we can get general description of this first tutorial. Okay, let's start!
But, before that, we need some preparation,
1. First, you need a computer that has text-editor program like notepad, wordpad, ms word etc.
2. Then, you also need prolog language compiler (in this tutorial we use swi-prolog).
3. And the last one, you need some spirit. So that we can finish this. Hehehehehe. Let's Begin!
To Make All Possible Combination of 2 Sets with Prolog, that must be done is:
First, type the elements of 2 sets in notepad like this!

Student and course is the name of 2 sets. Musa, Kukuh, Nanda is the elements of student set. Discrete and alpro is the elements of the course set. Then, save the file with prolog extension (*.pl) to the harddrive.
Second, open swi-prolog (you must install this software first to your computer). Then click file, and select consult menu.

Find the last prolog file (*.pl extension) that edited in notepad then press ok.
Third, type "student(X), course(Y)." without quotes. But, before that you must know that now we are in prolog compiler (swi-prolog) work layer. Okay, back to the topic, if you typed, press enter. After that you'll see like this,

The image show all combination of 2 sets (student and course). You also can type "course(X), student(Y)." to see other combination like this,

How about we type "student(X), course(Y)."? It means gives all elements which are both a student and a course (there are no such elements in the database). So, the result of the program is "No". You can see here,

Okay, maybe just it tutorial for this time. We'll continued to another time with the next tutorial and still with prolog. Hopefully this first post is helpfully.
http://discreteaddict.blogspot.com/2009/10/how-to-make-all-possible-combinations.html