Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Tally items that give the same value when a function is applied
ResourceFunction["TallyBy"][{e1,e2,…},f] tallies the elements ei for which f[ei] returns the same value and returns these f[ei] values and their counts. | |
ResourceFunction["TallyBy"][{e1,e2,…},f,g] applies function g to each list tallied by f and returns these g[ei] values and their counts. |
Tally, but do not care about the capitalization:
In[1]:= | ![]() |
Out[1]= | ![]() |
Return only the first entry rather than all of the entries for each equivalence partition:
In[2]:= | ![]() |
Out[2]= | ![]() |
Tally numbers that are close to each other and only show a "representative" number:
In[3]:= | ![]() |
Out[3]= | ![]() |
Tally words to find the largest anagram groups:
In[4]:= | ![]() |
Out[4]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License