Set primitive interface¶
A set is an unordered data structure that contains only distinct elements.
The interface¶
For a set parametrised over the element type T
:
new() -> Set
- creates an empty set.new(List) -> Set
- creates a set from the given list of elements. If the list contains duplicating elements, ignores them.size(Set) -> Nat
- returns the number of elements in the set.insert(Set, T) -> Set
- adds an element of typeT
to the set.union(Set, Set) -> Set
- computes the union of two sets.intersection(Set, Set) -> Set
- computes the intersection of two sets.difference(Set, Set) -> Set
- computes the difference of two sets. Note that this operation is not commutative.disjointUnion(Set, Set) -> Set
- computes the union of two sets. If the sets intersect, returns an error.contains(Set, T) -> Bool
- checks if an element is in the set.
Used in¶
- Transaction (roots, actions)
- Nullifier set