Set Constructor Expression

{ $\ms {[}$ expression-1 $\ms {[}$ ,expression-n $\ms {]}$ $\ms {]}$ }

The set constructor expression returns the set of the expressions in the member list. Duplicated values are added to the set only once. A warning message is produced when duplicates are detected. The constructor expression consists of zero or more subexpressions of the same scalar type or of tuple expressions that match in length and in element types.

The following statements output a three-member set and warn about the duplicated value 2:

proc optmodel;
   put ({1,2,3,2}); /* outputs {1,2,3} */

The following example produces a three-member set of tuples, using PROC OPTMODEL parameters and variables. The output is displayed in Figure 5.33.

proc optmodel;
   number m = 3, n = 4;
   var x{1..4} init 1;
   string y = 'c';
   put ({<'a', x[3]>, <'b', m>, <y, m/n>});

Figure 5.33: Set Constructor Expression Output