tally function
How often each element occurs: a list of element and count pairs.
How to write it
tally(list)
- list
- The list. Takes a list.
Examples
tally([a, b, a])In the solver,
Open in the solvertally([a, b, a])gives[[a, 2], [b, 1]].
Related functions
- thread
Apply a function to corresponding elements of lists.
- take
The first elements of a list.
- total
Sum of the elements of a list.
- table
Build a list by evaluating an expression over one or more ranges.
- union
The elements in any of some lists, each once, in order.
- subsets
All the sublists of a list that keep its order, as a list.