Skip to main content
Version: Next

Sizing

The predefined functions Set.size and Set.cardinal return the number of elements in a given set.

const my_set: set<int> = Set.literal([3, 2, 2, 1]);
const cardinal : nat = Set.size(my_set); // == 3

Note: See the predefined namespace Set