Answer to Exercise 56

| ANSWER TO EXERCISE 56
    parse_name
    [ i j w; if (self has general) j='red'; else j='green';
             w=NextWord();
             while (w==j or 'fried')
             {   w=NextWord(); i++;
             }
             if (w=='tomato') return i+1;
             return 0;
    ],

Back to the exercise in section 24

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