home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / TESTS / LF / TEST04.LF < prev    next >
Text File  |  1996-06-04  |  1KB  |  59 lines

  1. %  File:    /usr/bloom2/slang/plummer/life/happy.life
  2. %  Author:  Hassan Ait-Kaci
  3. %  Created: Fri Oct  9 13:14:17 1987
  4. %  Updated: Mon Nov 14 12:40:46 1988
  5. %  Purpose: Login Example in LIFE.
  6. %  Copyright Information: Proprietary and Confidential
  7. %                         MCC (1987)
  8.  
  9.  
  10.  
  11. %    peter, paul and mary are students, and students are people.
  12.  
  13. peter <| student.
  14. paul  <| student.
  15. mary  <| student.
  16.  
  17. student <| person.
  18.  
  19.  
  20. %    grades are either goodgrades or badgrades.  
  21. %     a and b are goodgrades, while c, d and f are badgrades.
  22.  
  23. goodgrade <| grade.
  24. badgrade  <| grade.
  25.  
  26. a <| goodgrade.
  27. b <| goodgrade.
  28.  
  29. c <| badgrade.
  30. d <| badgrade.
  31. f <| badgrade.
  32.  
  33. %    Goodgrades are goodthings
  34.  
  35. goodgrade <| goodthing.
  36.  
  37.  
  38. %    Every person likes themself.
  39. %    Every person likes goodthings.
  40. %    peter likes mary.
  41.  
  42. likes(X:person,X).
  43. likes(person,goodthing).
  44. likes(peter,mary).
  45.  
  46.  
  47. %    peter got a c, paul an f and mary an a.
  48.  
  49. got(peter,c).
  50. got(paul,f).
  51. got(mary,a).
  52.  
  53.  
  54. %    A person is happy if they got something that they like, or,
  55. %    if they like someone who got a goodthing.
  56.  
  57. happy(X:person) :- got(X,Y),likes(X,Y).
  58. happy(X:person) :- likes(X,Y),got(Y,goodthing).
  59.