Hacker News new | ask | show | jobs
by nextaccountic 1345 days ago
What is group?
6 comments

A group is a non-empty set and an operation that combines any two elements of the set to produce a third element of the set, in such a way that the operation is associative, an identity element exists and every element has an inverse. /s
Some context would be really nice indeed.
https://gist.github.com/chrispsn/3450fe6172a7cc441d0819379ed... <- Here you go, some context about what group is and does (or was and did, in this case) in the K language.
Good point - added a simple explanation in the article:

Group tells you the places each element occurs in a list. It generates lists of indices.

Nice! Sounds useful for scatter and gather algorithms

https://en.wikipedia.org/wiki/Gather/scatter_(vector_address...

Group is (was) a function in various array languages, including K, APL, BQN, J, and Shakti.
Group is actually like inverse a mapping. Given an array A which map index to value, group A map value to index. A common idiom is: desc count each group A , which list most frequent element first
The Linux /etc/group file was my first and incorrect thought.