WLJS LogoWLJS Notebook

Tally

Tally[list] tallies the elements in list, listing all distinct elements together with their multiplicities.

Examples

Count element occurrences:

Tally[{a, b, a, c, b, a}]
(* {{a, 3}, {b, 2}, {c, 1}} *)

Count characters:

Tally[Characters["mississippi"]]
(* {{"m", 1}, {"i", 4}, {"s", 4}, {"p", 2}} *)

Please visit the official Wolfram Language Reference for more details.

On this page