Inform 7 Home Page / Documentation


§18.14. Grouping together something

1. When it happens. Only while listing contents, and only when a collection of items to be grouped together is reached. This in turn happens only if a "before listing contents" rule has chosen it (see previous section). The first item in the group is the one to which the activity formally applies.

The variable "listing group size" usually gives the number of items grouped together in this way, but care is needed if the "something" covers multiple groups, because then this will all be working on a list of groups, not of items. For example, in a "grouping together things" rule, where "things" is such a broad description that it can apply to multiple kinds of thing all appearing in the list, the list-maker is likely to set "listing group size" to the number of groups. If the list contains five men and six women, for example, "listing group size" might be 2 rather than 11.

2. The default behaviour. The items grouped together are printed in an English phrase, such as "egg, chicken and farmer". In particular, they are not split onto separate lines even if the rest of the list is. (See previous section.)

3. Examples. (a) Here are Scrabble pieces which are described as "the tile W from a Scrabble set" or similar outside of lists, but which, when they turn up together in lists, are rolled together into "the tiles A, B and D from a Scrabble set".

paste.png A Scrabble piece is a kind of thing. The X, the Y and the Z are Scrabble pieces.

Before listing contents: group Scrabble pieces together.

Before printing the name of a Scrabble piece while not grouping together, say "tile ". After printing the name of a Scrabble piece while not grouping together, say " from a Scrabble set".

Before grouping together Scrabble pieces, say "the tiles ". After grouping together Scrabble pieces, say " from a Scrabble set".

(b) Maybe we only want an abbreviated form when there are five or more tiles in one place:

paste.png A Scrabble piece is a kind of thing. The X, the W, the F, the Y and the Z are Scrabble pieces in the Lounge.

Before listing contents: group Scrabble pieces together.

Before grouping together Scrabble pieces when the listing group size is greater than 4:
    say "some [listing group size in words] tiles (".
After grouping together Scrabble pieces when the listing group size is greater than 4:
    say ") from a Scrabble set".

(c) We can throw out all pretence at listing and say whatever we like, in fact:

Before listing contents while taking inventory: group utensils together. Rule for grouping together utensils: say "the usual utensils".


arrow-up.png Start of Chapter 18: Activities
arrow-left.png Back to §18.13. Listing contents of something
arrow-right.png Onward to §18.15. Issuing the response text of something