/*

   COSC3008     First Example-1                 12/12/2005  

*/

  

domains           % Declares new data types in addition to some predefined ones

            % such as integer, real, symbol

   name = symbol

   gpa  = real

 

predicates  % Declares predicates and domains of their arguments

   honor(name)

   student(name, gpa)

   probation(name)

 

clauses           % Body of the program where we specify

            % Facts and Rules in terms of predicates declared above.

   honor(Name):-      % A rule about an honor student.

      student(Name, GPA),

      GPA>=3.5,

      not(probation(Name)).

  

   student("Betty Blue", 3.5).      %     Seven facts for as many students.

   student("David Smith", 2.0).

   student("John Johnson", 3.7).

   student (oneName, 4).

   student (oneSpelling, 3.6).

   student ("Kim Novak", 2.2).

   student ("Connie Francis", 3.7).

   probation("Betty Blue").   %     Two facts for as many probation students

   probation("David Smith").

%  goal

%   honor(NAME), write(NAME), write("\n"), fail.

%   goal

%     student(XX,YY), write(XX), write("  "), write(YY).

%