frequency

Returns an associative array of counts of every element in input. Works w/ any iterable.

uint[ForeachType!(T)]
frequency
(
T
)
()
if (
isIterable!(T)
)

Examples

1 int[] foo = [1,2,3,1,2,4];
2 uint[int] frq = frequency(foo);
3 assert(frq.length == 4);
4 assert(frq[1] == 2);
5 assert(frq[4] == 1);

Meta