Navigation
Synopsis The difference between two sets.
Syntax Exp1 - Exp2
Types
Exp1 Exp2 Exp1 - Exp2
set[T1] set[T2] set[lub(T1,T2)]
set[T1] T2 set[lub(T1,T2)]
Description If both Exp1 and Exp2 have a set as value, the result is the difference of these two set values. If Exp2 does not have a set as value, it is first converted to a set before the difference is computed. The difference is computed by removing all elements of the second set from the first set.
Examples
rascal>{1, 2, 3, 4} - {1, 2, 3};
set[int]: {4}
rascal>{1, 2, 3, 4} - {3};
set[int]: {1,2,4}
rascal>{1, 2, 3, 4} - 3;
set[int]: {1,2,4}
rascal>{1, 2, 3, 4} - {5, 6, 7};
set[int]: {1,2,3,4}

Questions
Question [1]. When you compute the difference of two sets, the number of elements in the result is always:




Question [2].
The type of {"Isolder", "T", "Admiral Sarn"} - {"Telly Monster", "F", "Slimey the Worm", "V"} is

Question [3].
The type of {"Cayenne"} - {"Cayenne"} is

Question [4].
{0,50} - {68,69,50,84} == 

Question [5].
 - {6,73,16,80} == {81,18,88}

Question [6].
{1,70,11,45,79,81,84} -  == {70,84}



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.