![]() |
|
Navigation |
Synopsis Complement of a list relation.
Function
Usage
import ListRelation;
Description Given a list relation
R a new relation U can be constructed that contains
all possible tuples with element values that occur at corresponding tuple positions in R .
The function complement returns the complement of R relative to U , in other words: U - R .
Examples
rascal>import ListRelation;
ok
Declare R and compute corresponding U :
rascal>R = [<1,10>, <2, 20>, <3, 30>]; lrel[int,int]: [ <1,10>, <2,20>, <3,30> ] rascal>U = domain(R) * range(R); lrel[int,int]: [ <1,10>, <1,20>, <1,30>, <2,10>, <2,20>, <2,30>, <3,10>, <3,20>, <3,30> ]Here is the complement of R computed in two ways:
rascal>U - R; lrel[int,int]: [ <1,20>, <1,30>, <2,10>, <2,30>, <3,10>, <3,20> ] rascal>complement([<1,10>, <2, 20>, <3, 30>]); lrel[int,int]: [ <1,20>, <1,30>, <2,10>, <2,30>, <3,10>, <3,20> ] Questions
Question [1].
![]() ![]()
Question [2].
![]() ![]() ![]() |