Chapter 13: Relations
13.13. Relations involving values

Most of the openly declared relations in Inform are between things - people, for instance, or rooms - but beneath the surface, many relations also apply to values. For instance,

if the turn count is less than 100, ...

involves a relation between two numbers expressed by the verb "to be less than". These can also be created easily, provided we are willing to supply a definition. For instance:

Material is a kind of value. The materials are wood and metal. A thing has a material.

Materiality relates a thing (called X) to a material (called Y) when Y is the material of X. The verb to be made of implies the materiality relation.

Of course, this does no more than to wrap up a property in the language of relations, but that does give us the elegant wording

if the cube is made of wood, ...
say "The carpenter looks at [the list of things which are made of wood].";

as an alternative to:

if the cube is wood, ...
say "The carpenter looks at [the list of things which are wood].";

By writing a more interesting definition, we get a more interesting relation as a result, of course. Here is a mathematical one:

Divisibility relates a number (called N) to a number (called M) when remainder after dividing M by N is 0. The verb to divide (it divides, they divide, it divided, it is divisible) implies the divisibility relation. The verb to be a factor of implies the divisibility relation.

We now find that "2 divides 12", "5 is not a factor of 12" and "12 is divisible by 3" are all true. Again, we are only really gaining a nice form of words, but improving the clarity of the source text is never a bad thing.


220
* Example  Meet Market
A case in which relations give characters multiple values of the same kind.

RB


PreviousContentsNext