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

  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %    
  3. %  Simple examples
  4. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5.  
  6. module("simple") ?
  7. public(stu,emp,fact,secretary,faculty,person,student,employee) ?
  8.  
  9. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  10.  
  11. %%%
  12. %%% Prolog: member, xxxooo
  13. %%%
  14.  
  15. %%%
  16. %%%  Psi-terms, type constraints, unification. 
  17. %%%  see also prime.lf, dictionary.lf, soap.lf
  18. %%%
  19.  
  20. %
  21. %
  22. %                           person
  23. %                      _________________
  24. %                     /                 \
  25. %              student                   employee
  26. %             /       \                 /        \
  27. %       ------         \           staff          faculty
  28. %      /   |  \         \         /  |  \        /   |   \
  29. %   bob  piotr pablo     workstudy  art judy   don  john  sheila
  30. %                       /         \                  
  31. %                     simon      elena
  32. %                                 
  33.                                   
  34. student <| person.
  35. employee <| person.
  36.  
  37. staff <| employee.
  38. faculty <| employee.
  39.  
  40. workstudy <| student.
  41. workstudy <| staff.
  42.  
  43. bob    <| student.
  44. piotr  <| student.
  45. pablo  <| student.
  46. elena  <| workstudy.
  47. simon  <| workstudy.
  48. art    <| staff.
  49. judy   <| staff.
  50. don    <| faculty.
  51. john   <| faculty.
  52. sheila <| faculty.
  53.  
  54. :: faculty(secretary => staff,
  55.        assistant => person).
  56.  
  57. :: student(advisor  => faculty,
  58.            roommate => person).
  59.  
  60.  
  61. stu -> student( roommate => employee(representative => S),
  62.             advisor  => don(secretary => S)).
  63.  
  64. emp -> employee( advisor  => don(assistant => A),
  65.                  roommate => S:student(representative => S),
  66.          helper   => simon(spouse => A)).
  67.          
  68.             
  69. %%%
  70. %%% functions and residuation
  71. %%% see also solve.lf, schedule.lf
  72. %%%
  73.  
  74.  
  75. fact(0) -> 1.
  76. fact(X:real) -> X*fact(X-1).
  77.  
  78. secretary(X:faculty) -> X.secretary.
  79.  
  80. % events' handling
  81. %                    ,-configure_event
  82. %                    |
  83. %      ,-window_event|-expose_event
  84. %      |             |
  85. %      |             `-destroy_event
  86. %      |
  87. %      |                         ,-motion_event
  88. %      |            ,-mouse_event|
  89. %      |            |            `-button_event
  90. % event|-input_event|
  91. %      |            |
  92. %      |            `-keyboard_event
  93. %      |
  94. %      |-null_event
  95. %      |
  96. %      `-other_event
  97. %
  98.  
  99. handle_event(M:button_event) -> true |
  100.     handle_button_event(M),
  101.     handle_event(xGetEvent(my_window, mask => my_mask)).
  102.     
  103.  
  104. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  105.