Fact, Rules, Predicate, and Variable in Prolog (Part 2)

Hey Friend...
nice to meet you again..
now we will learn about exercse 2 :

Given some facts like below :

We must extend the program with rule that defines a couple with two arguments, the first will be the name of man, and the second is the name of female.

Process :
1. First, create new file in your Prolog and write the facts that given before and give neme of file couple.pl.
2. Then, extend the program that consist of facts, with rule at the bottom of facts like below :
couple(X,Y):-person(X, male),person(X, male).
3. Then, consult couple.pl
4. Write code : ?- couple(X,Y).
5. This is the result :

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

0 Response to "Fact, Rules, Predicate, and Variable in Prolog (Part 2)"

Posting Komentar