In the
k programming language,
count is the
monadic case of
#.
#x returns 1 if x is an atom. Otherwise, x is a vector, array, or list of some sort, and #x returns the number of elements on the first axis or top level of x.
Illustrated at the k command prompt (user input indented 2 spaces, results flush left):
#1 2 3
3
#1
1
#_n
1
#!0
0
a:(1 2 3; 4 5 6; 7 8 9; 10 11 12)
a
(1 2 3
4 5 6
7 8 9
10 11 12)
#a
4
#:'a
3 3 3 3
b:(1;1 2;1 2 3)
b
(1
1 2
1 2 3)
#b
3
#:'b
1 2 3