## set

/avail/Avail/Foundation/Bootstrap/Special Objects: set
Source: /avail/Avail/Foundation/Bootstrap/Special Objects
Categories: Primitives, Types
Supertypes: nontype
See: {«_‡,»}
A set is an immutable, finite, unordered collection of distinct, homogeneous values, called members or elements. The number of elements is the cardinality of the set. Breaking this down:
• Immutable means that the composition of a set is not subject to change. No operations are, or can be, defined to modify a set in any way; only operations that derive new sets from existing sets are expressible.
• Finite means that the cardinality of a set is never the value . To store a set in memory requires space proportional to its cardinality, and memory is clearly always finite. Additional limits to the practical cardinality of sets may be imposed by the implementation.
• Unordered means that the members of a set do not occur in any particular order. Any two sets with the same membership are therefore equal.
• Distinct means that a member occurs only once in the membership of a set. Thus a value is either a member of a set or it is not.
• Homogeneous means that the members of a set universally conform to a single most general type.
A literal set is expressed as a left curly bracket { (U+007B), then a list of members separated by commas , (U+002C), and finally a right curly bracket } (U+007D). The empty set is written as (U+2205). The elements of a set need not be known statically. Sets are constructed with the method {«_‡,»}; there is no special built-in syntax for constructing sets. When the compiler can infer an instance type for each argument expression of a particular send of this message, then the semantic restriction is able to strengthen the result to an instance type, thereby according it the same force as a literal understood primitively by the compiler.