Language Guide

CHAPTER 3
Values
38 Using Value Class Denitions
Elements 3
Elements of values are values contained within other values. Composite values
have elements; simple values do not. The sample value class definition in
Figure 3-1 shows one element, called an item.
Use references to refer to elements of composite values. For example, the
following reference specifies the third item in a list:
item 3 of {"To", "be", "great", "is", "to", "be", "misunderstood"}
--result: "great"
The “Reference Forms” section of a composite value class definition lists the
reference forms you can use to specify elements of composite values.
Operators 3
You use operators, such as the addition operator (+), the concatenation
operator (&), and the equality operator (=), to manipulate values. Values
that belong to the same class can be manipulated by the same operators.
The “Operators” section of a value class definition lists the operators that
can be used with values of a particular class.
For complete descriptions of operators and how to use them in expressions,
see “Operations,” which begins on page 161.
Commands Handled 3
Commands are requests for action. Simple values cannot respond to commands,
but composite values can. For example, lists can respond to the Count
command, as shown in the following example.
count {"This", "list", "has", 5, "items"}
--result: 5
Each composite value class definition includes a “Commands Handled” section
that lists commands to which values of that class can respond.