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

  1. /*
  2.    Turbo Prolog 2.0 Chapter 5, Example Program 11
  3.    
  4.    Copyright (c) 1986, 88 by Borland International, Inc
  5.    
  6. */
  7.    
  8. predicates
  9.    likes_shopping(symbol)
  10.    has_credit_card(symbol, symbol)
  11.    bottomed_out(symbol, symbol)
  12.  
  13. clauses
  14.    likes_shopping(Who) :- 
  15.       has_credit_card(Who, Card),
  16.       not (bottomed_out(Who, Card) ) ,
  17.       write(Who, " can shop with the ",Card, " credit card.\n").
  18.  
  19.    has_credit_card(chris, visa).
  20.    has_credit_card(chris, diners).
  21.    has_credit_card(joe, shell).
  22.    has_credit_card(sam, mastercard).
  23.    has_credit_card(sam, citibank).
  24.  
  25.    bottomed_out(chris, diners).
  26.    bottomed_out(sam, mastercard).
  27.    bottomed_out(chris, visa).
  28.