Selasa, 13 Oktober 2009

TUTORIAL


Combinations of two sets

example:

a = {1,2}

b= {3,4}

So, there four combinations of two sets. they are {1,3}, {1,4}, {2,3}, and {2,4}.

if we use "prolog" to find the combinations of the sets, we can write in notepad like this:


a(1).

a(2).

b(3).

b(4).

sets(x):-a(x).

sets(y):-b(y).

combination(x,y):-a(x),b(y).



Then, its prolog is showed by this picture:





2 komentar: