![]() |
|
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].
![]() ![]()
Question [2].
![]() ![]() ![]() |