Navigation
Synopsis Union of two set values.
Syntax Exp1 + Exp2
Types
Exp1 Exp2 Exp1 + Exp2
set[T1] set[T2] set[lub(T1,T2)]
Description The + operator computes set union if both operands are sets. If one of the operands is not a set, it acts as Set/Insert instead.
Examples
rascal>{1, 2, 3} + {4, 5, 6};
set[int]: {1,2,3,4,5,6}
rascal>{1,2,3} + {2,3,4};
set[int]: {1,2,3,4}
rascal>{1, 2, 3} + {3};
set[int]: {1,2,3}
rascal>{2} + { 2, 3, 4};
set[int]: {2,3,4}

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




Question [2].
The type of {-0.8229529193332840, 14.3629319944383400, -2.2397703755013920, -7.48901397035860240} + {-7.75489207353992960, 0.4300941896702160, -9.6282294318282120} is

Question [3].
{"Curry"} + {"Hoots The Owl", "Pepper", "Mango", "Cookie Monster", "Countess Von Backwards"} == 

Question [4].
{"Kiwifruit", "I"} +  == {"Kiwifruit","Bruno","Ginger","I","Obi-Wan Kenobi","W"}

Question [5].
{12, 2, -8, -2} + {-9} == 

Question [6].
{7, 13, -17, -4} + {} == 



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.