Navigation
Synopsis Make sets of elements in the domain that relate to the same element in the range.
Function set[list[&U]] groupDomainByRange(lrel[&U dom, &T ran] input)
Usage import ListRelation;
Examples
rascal>import ListRelation;
ok
rascal>legs = [<"bird", 2>, <"dog", 4>, <"human", 2>, <"spider", 8>, <"millepede", 1000>, <"crab", 8>, <"cat", 4>];
lrel[str,int]: [
  <"bird",2>,
  <"dog",4>,
  <"human",2>,
  <"spider",8>,
  <"millepede",1000>,
  <"crab",8>,
  <"cat",4>
]
rascal>groupDomainByRange(legs);
set[list[str]]: {
  ["dog","cat"],
  ["spider","crab"],
  ["bird","human"],
  ["millepede"]
}
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.