Navigation
Synopsis Convert a list to a relation.
Function rel[&T,&T] toRel(list[&T] lst)
Usage import List;
Description Convert a list to relation, where each tuple encodes which elements are followed by each other. This function will return an empty relation for empty lists and for singleton lists.
Examples
rascal>import List;
ok
rascal>toRel([3, 1, 4, 5]);
rel[int,int]: {
  <4,5>,
  <1,4>,
  <3,1>
}
rascal>toRel(["zebra", "elephant", "snake", "owl"]);
rel[str,str]: {
  <"snake","owl">,
  <"zebra","elephant">,
  <"elephant","snake">
}

Questions
Question [1].
The type of toRel([11, 8, 0, 11]) is

Question [2].
toRel(["Bruno", "Dill", "Blackcurrant", "I"]) == 



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.