Listing group size with duplicates

#1

So when I run this code:

[code]The Library is a room.

A book is a kind of thing. A DVD is a kind of thing. A CD is a kind of thing.

In the Library are 2 books, 2 DVDs, and 1 CD.

Before listing contents:
group things together.

Rule for grouping together things:
say “[listing group size in words] items”.[/code]

I get this erroneous output:

I can halfway see what’s gone wrong here (it’s counting 3 kinds of things, instead of 5 actual things, presumably because the things have been created as duplicates instead of things in their own right - even though I can act on them individually so it clearly “knows” they’re all there) but it’s rather inconvenient and doesn’t seem like desirable behaviour.

Does anyone know of a way around this, and/or should I log it as a bug?

0 Likes

#2

What is your desired output - “You can see 5 items here”?

0 Likes

#3

It may be slightly inconvenient, but I wouldn’t say this was a bug. Listing group size is an I6 global (listing_size) which is used in the list-writer routine; it presumably behaves as needed by that routine.

You can do something like this:

Definition: a thing is impersonal if it is not a person.
Before listing contents:
	group things together.	
Rule for grouping together something (called A):
	let N be the number of impersonal things in the holder of A;
	say "[N] things".
0 Likes

(matt w) #4

I’d say it’s a bug. The documentation (Writing with Inform §18.14) says:

The variable "listing group size" gives the number of items grouped together in this way.

which seems to mean that if five things are being grouped together, the listing group size ought to be 5.

0 Likes

#5

Well, “item” doesn’t necessarily mean “thing”. I read it as “list entry”: what would usually be listed as three items is being grouped as one.

But I guess it might as well be reported; it’s either a bug, or a documentation error, or maybe just an ambiguity.

0 Likes

#6

Thanks all - the workaround works perfectly in the meantime, but I’ll report it anyway: either it’s an oversight that can be fixed, or it’s done that way for some back-end reason, so the documentation should be clarified.

0 Likes