card
Gives the cardinality of a set.
Syntax

card(S)

S
is a set

Description
If S
is a set, then card(S)
is the cardinality of S
.
Notes
card
and cardinality
are synonyms of length
, which is the function implementing the #
prefix operator. Hence, if S
is a set (or any other container), the following are equivalent expressions:

card(S)

cardinality(S)

length(S)

#S
.
Naturally, however, card
and cardinality
are function names that are semantically pleasant to apply to sets specifically. (We talk about the “cardinality” of a set, the “length” of a string, and the “dimension” of a vector.)
Examples
card({2, 1, 0, −3, 8, 5})
6
f ≔ n ↦ if(even(n), n/2, 3⋅n + 1);
card(orbit(f, 1000))
112