SET sizeNumber inputVector resultVariable

Replaces the contents of the resultVariable with "sizeNumber" copies of all of the elements of the inputVector. The inputVector may be either a numeric literal, a named constant, a literal vector, a sequence specification, a multiple specification, or a variable.

This command is no longer needed since its functionality has been incorporated into the COPY command combined with multiple literals (see examples at right). It has been left in the language for backward compatibility even though the functionality of this command has been expanded from that of the Resampling Stats version of the command. In the Resampling Stats SET command, if the inputVector had more than one element, only the first element is replicated. In Statistics101, the entire inputVector is replicated.


COPY 5 N
SET N 4 A
SET 5 4 B
URN 5#4 C
COPY 5#4 D
COPY N#4 E
PRINT A B C D E

The above program shows multiple ways of using and the SET command as well as ways of accomplishing the same thing as SET does using other commands. The program produced the following:

A: (4.0 4.0 4.0 4.0 4.0)
B: (4.0 4.0 4.0 4.0 4.0)
C: (4.0 4.0 4.0 4.0 4.0)
D: (4.0 4.0 4.0 4.0 4.0)
E: (4.0 4.0 4.0 4.0 4.0)

This next program shows the SET command's enhanced behavior described at left. It shows the creation of a vector containing four copies of the literal sequence 1,3. It also shows the creation of a similar vector using the COPY command.

SET 4 1,3 vec1
COPY 4#1,3 vec2
PRINT vec1 vec2

Here is the result of the above program:

vec1: (1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0)
vec2: (1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0)

A practical example would be the construction of a card deck (again showing two ways to do so, one with SET and one with COPY):

SET 4 1,13 deck1
COPY 4#1,13 deck2
PRINT deck1 deck2