home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / MOD2SRC.ZIP / SETS.MOD < prev    next >
Text File  |  1987-02-08  |  3KB  |  84 lines

  1.                                         (* Chapter 10 - Program 3 *)
  2. MODULE Sets;
  3.  
  4. FROM InOut IMPORT WriteString, WriteLn;
  5.  
  6. TYPE Goodies = (IceCream,WhippedCream,Banana,Nuts,Cherry,
  7.                 ChocSyrup,StrawBerries,Caramel,SodaWater,
  8.                 Salt,Pepper,Cone,Straw,Spoon,Stick);
  9.  
  10.      Treat = SET OF Goodies;
  11.  
  12. VAR  Sundae       : Treat;
  13.      BananaSplit  : Treat;
  14.      Soda         : Treat;
  15.      IceCreamCone : Treat;
  16.      NuttyBuddy   : Treat;
  17.      Mixed        : Treat;
  18.      Index        : Treat;
  19.  
  20. BEGIN
  21.         (* Define all ingredients used in each treat *)
  22. IceCreamCone := Treat{IceCream,Cone};
  23. Soda := Treat{Straw,SodaWater,IceCream,Cherry};
  24. BananaSplit := Treat{IceCream..Caramel};
  25. BananaSplit := BananaSplit + Treat{Spoon};
  26. NuttyBuddy := Treat{Cone,IceCream,ChocSyrup,Nuts};
  27. Sundae := Treat{IceCream,WhippedCream,Nuts,Cherry,ChocSyrup,
  28.            Spoon};
  29.  
  30.                 (* Combine for a list of all ingredients used *)
  31. Mixed := IceCreamCone + Soda + BananaSplit + NuttyBuddy +
  32.          Sundae;
  33.  
  34.                 (* Now find what ingredients are not used *)
  35.  
  36. Mixed := Treat{IceCream..Stick} - Mixed;
  37.  
  38.    IF IceCream     IN Mixed THEN
  39.                   WriteString('Ice cream not used');
  40.                   WriteLn; END;
  41.    IF WhippedCream IN Mixed THEN
  42.                   WriteString('Whipped Cream not used');
  43.                   WriteLn; END;
  44.    IF Banana       IN Mixed THEN
  45.                   WriteString('Bananas not used');
  46.                   WriteLn; END;
  47.    IF Nuts         IN Mixed THEN
  48.                   WriteString('Nuts not used');
  49.                   WriteLn; END;
  50.    IF Cherry       IN Mixed THEN
  51.                   WriteString('Cherries not used');
  52.                   WriteLn; END;
  53.    IF ChocSyrup    IN Mixed THEN
  54.                   WriteString('Chocolate Syrup not used');
  55.                   WriteLn; END;
  56.    IF StrawBerries IN Mixed THEN
  57.                   WriteString('Strawberries not used');
  58.                   WriteLn; END;
  59.    IF Caramel      IN Mixed THEN
  60.                   WriteString('Caramel not used');
  61.                   WriteLn; END;
  62.    IF SodaWater    IN Mixed THEN
  63.                   WriteString('SodaWater not used');
  64.                   WriteLn; END;
  65.    IF Salt         IN Mixed THEN
  66.                   WriteString('Salt not used');
  67.                   WriteLn; END;
  68.    IF Pepper       IN Mixed THEN
  69.                   WriteString('Pepper not used');
  70.                   WriteLn; END;
  71.    IF Cone         IN Mixed THEN
  72.                   WriteString('Cone not used');
  73.                   WriteLn; END;
  74.    IF Straw        IN Mixed THEN
  75.                   WriteString('Straw not used');
  76.                   WriteLn; END;
  77.    IF Spoon        IN Mixed THEN
  78.                   WriteString('Spoon not used');
  79.                   WriteLn; END;
  80.    IF Stick        IN Mixed THEN
  81.                   WriteString('Stick not used');
  82.                   WriteLn; END;
  83. END Sets.
  84.