home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l210 / 1.ddi / EXAMPLES.ARC / CH03EX02.PRO < prev    next >
Encoding:
Prolog Source  |  1988-06-21  |  538 b   |  34 lines

  1. /*
  2.    Turbo Prolog 2.0 Chapter 3, Example Program 2
  3.    
  4.    Copyright (c) 1986, 88 by Borland International, Inc
  5.    
  6. */
  7.    
  8. predicates
  9.    can_buy(symbol, symbol)
  10.    person(symbol)
  11.    car(symbol)
  12.    likes(symbol, symbol)
  13.    for_sale(symbol)
  14.  
  15. clauses
  16.    can_buy(X, Y) :-
  17.     person(X),
  18.     car(Y),
  19.     likes(X, Y),
  20.        for_sale(Y).
  21.    
  22.    person(kelly).
  23.    person(judy).
  24.  
  25.    car(lemon).
  26.    car(hot_rod).
  27.  
  28.    likes(kelly, hot_rod).
  29.    likes(judy, pizza).
  30.  
  31.    for_sale(pizza).
  32.    for_sale(lemon).
  33.    for_sale(hot_rod).
  34.