Algosim documentation: length

length

The length function.

Syntax

Description

In general, if X is a container, then length(X) is the number of elements it contains. Depending on the type of X, this number is typically referred to as the “cardinality”, “dimension”, “length”, or “size” of X.

Notes

The prefix operator # is mapped to the length function.

card and cardinality are synonyms of length.

Examples

P ≔ filter(SequenceList(1000), IsPrime); #P
168
#functions()
781
f ≔ n ↦ if(even(n), n/2, 3⋅n + 1);
#orbit(f, 1000)
112
A ≔ ❨❨6, 3, 2, 0, 4, 5❩, ❨7, 0, 2, 1, 4, 2❩, ❨6, 2, 3, 1, 4, 2❩, ❨8, 0, 2, 3, 3, 5❩, ❨4, 2, 6, 3, 2, 0❩❩
⎛6  3  2  0  4  5⎞
⎜7  0  2  1  4  2⎟
⎜6  2  3  1  4  2⎟
⎜8  0  2  3  3  5⎟
⎝4  2  6  3  2  0⎠
#A
30

See also