??ANSWER TO EXERCISE 50

Use the invent routine to signal to short_name and article routines to change their usual habits:

       invent
       [;  if (inventory_stage==1) give self general;
           else give self ~general;
       ],
       short_name
       [;  if (self has general) { print "box"; rtrue; } ],
       article
       [;  if (self has general) { print "that hateful"; rtrue; }
           else print "a"; ],

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