A mathematical constant is a term with a fixed value. In a binary term, it is distinct from a hole, which can receive a substitution, and from a symbol, which has a name and child terms. section 10.1
Constants participate in equality and unification in specific ways:
- Two constants are equal exactly when their values are equal. section 10.1
- A constant can occupy a term position without becoming a substitution target; substitutions map holes to terms. section 10.1
- Type-inference terms use constants such as List, Func, and double to represent fixed type components. section 10.3
Values inside a binary term
The term ImStack(2, Y) contains the constant 2 and the hole Y. Unification can determine a value for Y, but the constant 2 already has its value; it matches another constant only when that constant also represents 2. section 10.1
Figure 10.2 Our immutable stack unification problem looks nearly identical when drawn as a binary term. Again, holes are squares, symbols are ovals, and constants are circles.
The diagram distinguishes constants as circles from symbols as ovals and holes as squares. section 10.1
