Navigation
Synopsis Invert the (key,value) pairs in a map.
Function map[&V, set[&K]] invert(map[&K, &V] M)
Usage import Map;
Description Returns inverted map in which each value in the old map M is associated with a set of key values from the old map. Also see invertUnique.
Examples
rascal>import Map;
ok
rascal>invert(("apple": 1, "pear": 2, "orange": 1));
map[int, set[str]]: (
  1:{"orange","apple"},
  2:{"pear"}
)
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.