[Next] [Up] [Previous] [Contents]
Next: The set inclusion operator Up: Expressions Previous: Comparison operators

Set expressions

A set is specified as a list of elements between curly brackets:

        { elem, ... , elem }

Note that a set cannot be empty - there must be at least one element. Each element can be one of the following:

The set x..y can be abbreviated to x..y.

Note that a set expression may represent the empty set in the case that all elements are guarded, and all the guard conditions are false. In this case the result of the set expression is undefined. Thus, for example:

        {1 ? foo, 1 ? bar}  =  {foo,bar}
        {1 ? foo, 0 ? bar}  =  {foo}
        {0 ? foo, 0 ? bar}  =  undefined
The reason for this rule is that a set expression is interpreted (with one exception, below) to represent a non-deterministic choice between the values in the set. A choice between the empty set of values is not meaningful.





Ken McMillan
Sat Jun 6 21:41:59 PDT 1998