Lists with indefinite articles, and identical objects.

The following code:

[code]“Apples” by Victor Gijsbers

Orchard is a room. The player is in orchard.

An apple is a kind of thing. The player carries two apples.
The player carries a book.

When play begins:
say “You carry [list of things carried by the player]. In other words, you carry [list of things carried by the player with indefinite articles].”.[/code]
leads to the following output:

This does not make me happy, because I want to see “two apples and a book”. Why does a list with articles pull apart identical objects? Is there a way to have this not happen?

You want this:

	say "You carry [a list of things carried by the player]."

Your second phrase invokes a different list-writer, which doesn’t collect duplicates. That isn’t answering your question so much as restating it, but that’s the situation.

(Look in the standard rules, at the difference between “To say a list of (OS - description of objects)” and “To say (L - a list of objects) with indefinite articles”.)

Thanks! That works perfectly.

(I must say: the difference in behaviour between these two phrases is not exactly clear from the syntax.)

Wait, so does this mean that if you have constructed a list, there is no easy way to get the result I desired? Assuming “K” is your list, you cannot even compile “say [a K]”.

Not very easily, no.

This works, but only for a list that’s a global variable:

K is a list of things variable.

Definition: a thing is K-listed if it is listed in K.

When play begins:
	add the list of carried things to K;
	say "You carry [a list of K-listed things]."

I can’t figure a way to phrase that without the global “K-listed” adjective. Not without an I6 phrase definition, anyway (which I leave as an exercise for, er, somebody else).

That was bugging me just now - more generally, the lack of an obvious way to specify an object by its properties. I was messing around with Robert Rothman’s scoring question, and discovered that this does not compile:

Report requesting the score: Repeat with T running from 1 to the turn count: if there is an achievement with earned of T, say "You succeeded in [list of achievements with earned of T] on turn [T].";

Neither instance of “achievement with earned of T” is allowed. Neither is “If an achievement has earned of T” or any other phrasing I can think of.

Oh, that’s easy – you have to define a sentence verb.

An achievement is a kind of thing. Some achievements are defined by the Table of Score Awards. 

Table of Score Awards
Achievement	Points	Earned
giz-getting	1	0
giz-examining	2	0
   
The verb to earn (it earns, they earn, it is earning) implies the earned property.

Report requesting the score:
	Repeat with T running from 1 to the turn count:
		if an achievement earns T:
			say "You succeeded in [list of achievements earning T] on turn [T].";

But this doesn’t help for the listed-in-K case, because “N is listed in K” is a boolean phrase, not a property of K.

(But please don’t iterate from 1 to the turn count. Wow. That would take forever. Just keep a table of achievements, add new ones in order, and write some finicky code to iterate through it.)

Well, my first thought was to check if you could repeat running through objects in a particular sort order… I guess a table is the only way to sort?

Tables and lists are the only ways to sort. But obviously if you add achievements to a table as they occur, the table will always be in sorted order!

I just realized that my example above works when achievement is a kind of thing, but not when achievement is a kind of value. I can’t think of any reason why that’s not a bug (I’ll report it). But you can make them things easily enough.

Got it, by way of a sentence verb and a conditional relation. I won’t claim this is pretty either, but it doesn’t require a global variable…

I only see this now – great!