Answer to Exercise 81

| ANSWER TO EXERCISE 81
| A slight refinement of such a "purloin'' verb is already defined in the library (if the constant `DEBUG` is defined), so there's no need. But here's how it could be done:
    [ Anything i;
      if (scope_stage==1) rfalse;
      if (scope_stage==2)
      {   objectloop (i ofclass Object) PlaceInScope(i); rtrue; }
      "No such in game.";
    ];
(This disallows multiple matches for efficiency reasons -- the parser has enough work to do with such a huge scope definition as it is.) Now the token `scope=Anything` will match anything at all, even things like the abstract concept of 'east'.

Back to the exercise in section 28

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