next up previous
Next: A program ... FINALLY!! Up: No Title Previous: Programming Guidelines

More Examples

Two people are neighbours if they live on the same street but in different houses.

 neighbour( Person_A, Person_B) :-
   address( Person_A, Street, Num),
   address( Person_B, Street, Num1).

Translate the following into Prolog rules :

  1. Nothing is good and bad at the same time.
  2. X lives if X is a human, if he/she breathes and if his/her pulse-rate is greater than zero.
  3. I hate McDonalds.
  4. Liam plays all the songs that the Beatles played without a keyboard.
  5. At the restaurant I can have cheese with apple or bread or coffee and chocolate with donuts.



Omer F Rana
Mon Feb 3 13:14:13 GMT 1997