Web : Discrete Addict: Fact, Rules, Predicate, and Variable in Prolog (part 1) - URL : http://discreteaddict.blogspot.com/2009/11/fact-rules-predicate-and-variable-in.html
www.kang-musa.co.cc
.

Fact, Rules, Predicate, and Variable in Prolog (part 1)

Step 1
Type the following program into a file and load it into Prolog. If you don't know how to load into prolog, see this posting.


Click to See Larger

Step 2
Okay, to search all mammal animal, type this command into prolog:
animal(mammal,A,_,_).
"A" is a variable and "_" mean DON'T SHOW anything from source in the line which can possibility show.


Click to See Larger

Step 3
To search all the carnivores that are mammals, type this command into prolog: animal(mammal,A,carnivore,_).


Click to See Larger

Step 4
To search all mammals with stripes, type this command into prolog: animal(mammal,A,_,stripes).


Click to See Larger

Step 5
Now, if We want to search a reptile that has a mane, use this command : animal(_,A,_,mane).


Click to See Larger

0 komentar:

Posting Komentar

 

Home - About Us - Profile - Tutorial - Literature - Relation