I have a counts function that takes an array of elements and returns counts of each unique item, like uniq -c:
counts
uniq -c
counts([\'a\', \'b\', \'a