Group Rules

A Group Rule is a special rule that is not cached and does not return a value. It is not invoked by users or by other rules. It is used to set one or more Canonicals.

Syntax

Group rules use a special syntax. They have no type, so type flags are not used.

Group <identifier> (GivenList)
   Statements
End Group

A member of the list of given parameters (“givens”) can activate a group rule. In a group rule statement block, at least one of the statements must be an assignment to a basic rule that has been declared Canonical.

A Group rule declares how Canonicals are computed, given a certain set of parameters. Using Group rules, a design can support alternative ways of specifying essential details.

For example, a simple circle may defined in dozens of ways: by a center and radius; by a diameter and two tangent lines; and so on. Each method is legitimate, but it is not practical to present hundreds of options to the user to define a simple circle.

Typically, systems present a subset of possibilities. Intent uses a language-based solution known as Partial Specification: specifying partial solutions through the use of rules. When enough partial solutions are available, a complete specification is formed.

The example below represents a classic case: Radius and Diameter; either can be computed from the other, but sometimes it is more convenient to specify a particular one.

Canonical Parameter Rule radius As Number = Required
Parameter Rule diameter As Number = radius * 2
Group diameter_only (diameter)
   radius = diameter / 2
End Group

Two parameters, diameter and radius, are defined. Radius is also declared to be a canonical. If the parameter value is supplied, it is used first.

Note: Canonicals that are also parameters act as pseudo-group rules. If supplied, they automatically are considered computable.

If the diameter parameter is supplied, then evaluating radius will invoke the diameter_only group rule to compute the radius.