Navigation
Synopsis Splice the elements of a set in an enclosing set.
Syntax *Exp
Types
Exp Exp1 Expn {Exp1, ..., Exp, ..., Expn}
T T1 Tn set[lub(T1, ..., T, ...,Tn)]
Description The operator * splices the elements of a set in an enclosing set.
Examples Consider the following set in which the set {10, 20, 30] occurs as set element. It has as type set[value]:
rascal>{1, 2, {10, 20, 30}, 3, 4};
set[value]: {1,2,3,4,{10,20,30}}
The effect of splicing the same set element in the enclosing set gives a flat list of type set[int]:
rascal>{1, 2, *{10, 20, 30}, 3, 4};
set[int]: {1,2,3,4,10,20,30}
The same example can be written as:
rascal>S = {10, 20, 30};
set[int]: {10,20,30}
rascal>{1, 2, *S, 3, 4};
set[int]: {1,2,3,4,10,20,30}
Benefits The splicing operator gives full, explicit, control over the way in which nested sets are handled.
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.