CONCAT inputVector {inputVector} resultVariable

Concatenates the elements of the input vectors in the order listed and puts the result in the result variable.

In Statistics101, this command has been generalized to allow input of any number and mix of input vectors and/or any kind of literal list, literal sequence, or multiple lilteral (quantity#value). See Using the Sequence and Multiple Operators.

The following commands are synonyms for the CONCAT command: DATA, NUMBERS, URN, and COPY. They are all identical except for their names. Use whichever name is most meaningful in context.

CONCAT 1,5 A
CONCAT (5 6 8 14 20) B
CONCAT 4#5 C
PRINT A B C

The above program produces the following output:

A: (1.0 2.0 3.0 4.0 5.0)
B: (5.0 6.0 8.0 14.0 20.0)
C: (5.0 5.0 5.0 5.0)

The next program...

CONCAT 4,1 (2 3 5) 3#9 2 5 A
PRINT A

...produced this output:

A: (4.0 3.0 2.0 1.0 2.0 3.0 5.0 9.0 9.0 9.0 2.0 5.0)

If you want to concatenate one or more vectors onto the beginning or end of another vector, you would do it like this:

CONCAT 1,5 A     'original vector
CONCAT 10,20 A A 'add 10,20 to start of A
'or
CONCAT A 10,20 A 'add 10,20 to end of A

Here's a practical example: When choosing 2 students at random from a class of 10 boys and 15 girls, what is the probability of their both being girls?

NAME boy girl
CONCAT 10#boy 15#girl students
CONCAT 1000 repeatCount
CONCAT 1 successCount
REPEAT repeatCount
   SAMPLE 2 students winners
   COUNT winners =girl girlCount
   IF girlCount =2
      ADD 1 successCount successCount
   END
END
DIVIDE successCount repeatCount probability
PRINT probability

The above program produces the following output:

probability: 0.353