Subscribe:

Hello there, we meet again,
now we're gonna learn about fact using Prolog.
Okey, let's start....

Exercise 1 : Animal

This Exercise is to show how to devise and test goals to find (a) all the mammals, (b) all the carnivores that are mammals, (c) all the mammals with stripes, (d) wether there is reptile that has a mane.

First run prolog.exe and then make a database.

This is how to show all the animals.

We can see that all the mammals are :

Next, how to find all the carnivoran mammals.

We can see that all the carnivoran mammals are :

Then, how to know all mammals that have stripes?

We can see that mammals that have stripes are zebra and tiger.


Now lets try to find is there any reptile that have mane?


Ooops...there's no reptille that have mane.


Exercise 2 : Couple

Lets extend the program with a rule that defines a predicate couple with two arguments, the first being the name of a man and the second being the name of a woman.

Load your revised program into Prolog and lets test it.

Now we'll try to make some couples from 3 men and 3 women, there's 9 posibilities.

Lets begin...

First run prolog.exe then make a database.



input the command and the result is


Soooo eazy rite?


Hope you enjoy and understand all steps of this tutorial,

just like we do (^_^)V


Okay...

see you on next tutorial from us,

don't miss it!!!


Regards,

Mathlovers.





Tidak ada komentar:

Posting Komentar

 
Copyright 2009 mathlovers