Does it have a name? Grouping objects by collections they belong to
There are some collections - let's say each collection is set of programming languages a developer knows.
{"Alice"开发者_JS百科 => Set["Java", "Python", "C++"], "Bob" => Set["Ruby"], "Charlie" => Set["Ruby", "C++"]}
.
I want to group these objects by collections they belong to - in this case getting a mapping from sets of developers sharing knowledge of certain languages to sets of such languages. Every language present in the input will occur exactly once here:
{Set["Alice"] => Set["Java", "Python"], Set["Alice", "Charlie"] => Set["C++"], Set["Bob", "Charlie"] => Set["Ruby"]}
Type of this operation would be Hash[A, Set[B]] => Hash[Set[A], Set[B]]
. (in practice plain arrays would most likely be used instead of sets, I'm using sets here to say that order doesn't matter and there are no duplicates)
I'm not asking how to code this operation (of course if you know a particularly elegant way, feel free to share) - I'm wondering if it has a name. It seems common enough that it should, but I cannot think of anything.
"Reverse Mapping"?
精彩评论