Answer to Exercise 64

| ANSWER TO EXERCISE 64
    Global c_warned = false;
    Class  Cherub
      with parse_name
           [ i j flag;
             for (flag=true:flag:flag=false)
             {   j=NextWord();
                 if (j=='cherub' or j==self.name) flag=true;
                 if (j=='cherubs' && (~~c_warned))
                 {   c_warned=true;
                     parser_action=##PluralFound; flag=true;
     print "(I'll let this go once, but the plural of cherub is cherubim.)^";
                 }
                 if (j=='cherubim')
                 {   parser_action=##PluralFound; flag=true; }
                 i++;
             }
             return i-1;
           ];
Then again, Shakespeare even wrote "cherubins'' in 'Twelfth Night', so who are we to censure?

Back to the exercise in section 25

Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.