Sets are unordered collections of values of the same type, like lists are ordered collections. Like the mathematical sets and lists, sets can be empty and, if not, elements of sets in LIGO are unique, whereas they can be repeated in a list.
Like lists, the type of sets is parameterised over the type of its elements. Like list elements, set elements must all have the same type.
The empty set is denoted by the predefined value
non-empty set can be built by using the function
takes a list of elements and returns a set containing them, and only
Note: See the predefined namespace Set
Note: The element
2is repeated in the list, but not in the set made from it.
Set elements are internally sorted by increasing values, so the type of the elements must be comparable, that is, they obey a total order (any two elements can be compared).