§21.6. Lists of objects
Lists can be made of values of any kind (including other lists), but lists of objects are especially useful. We could always make these "by hand":
let L be {the pot plant, the foxglove};
But it is usually easier and clearer to use descriptions.
list of (description of values) ... value
This phrase produces the list of all values matching the given description. Inform will issue a problem message if the result would be an infinite list, or one which is impractical to test: for instance "list of even numbers" is not feasible.
While that works nicely for many kinds of value ("list of recurring scenes", say), it's particularly useful for objects:
let L be the list of open containers;
add the list of open doors to L;
means that L now contains the open containers (if any) followed by the open doors (if any). Or, for example:
let L be the list of things;
remove the list of backdrops from L;
makes a list of all non-backdrops.
As mentioned above, lists of objects can be said in two additional ways:
"[L with definite articles]"
"[L with indefinite articles]"
And as mentioned below, they can be sorted in property value order:
sort L in P order;
sort L in reverse P order;
where P is any value property. In all other respects, lists of objects are no different to other lists.
![]() | Start of Chapter 21: Lists |
![]() | Back to §21.5. Building lists |
![]() | Onward to §21.7. Lists of values matching a description |
|
|