### Using the Sequence and Multiple Operators

There are two operators that are helpful in creating certain common kinds of vectors. These are the Sequence operator (,) and the Multiple operator (#). They can be used with any command that takes a vector as an input argument.

The sequence operator is most often used to create a vector made up of integer elements that differ by one. For example, this sequence specification, 5,8 is equivalent to this vector: (5 6 7 8). The reverse specification, 10,5 is equivalent to (8 7 6 5). It can also be used to create a sequence of numbers that differ by some floating point amount called the "step". The step is assigned following a second comma. For example, 5.5,7,0.5 represents the sequence (5.5 6.0 6.5 7.0). The sequence operator can also create a vector made up of named constants (see the NAME command). An example of this is mon,fri which would be equivalent to (mon tue wed thu fri) if these had been properly defined in a NAME command.

The multiple operator is used to create a vector that contains multiple copies of another vector. For example, this multiple specification, 3#5 is equivalent to (5 5 5). As another example, 3#(1 2 3) is equivalent to (1.0 2.0 3.0 1.0 2.0 3.0 1.0 2.0 3.0).

The multiple operator has one advanced feature. It can take a sequence spec as its right hand side. So for example, in this spec, 3#5,8 the sequence is evaluated first, then the multiple operator is applied. The result is (5.0 6.0 7.0 8.0 5.0 6.0 7.0 8.0 5.0 6.0 7.0 8.0).

Neither operator will accept a literal vector on its left side. Thus (1 2 3),5 and (1 2 3)#5 are both errors. And a literal vector is not accepted on the middle or the right hand side of the sequence operator. But since a literal vector is meaningful on the right of the multiple operator, it is accepted, as can be seen in one of the above examples.

The following table summarizes the many possible combinations and their meanings for the two operators. Assume that the following commands have been executed prior to these examples:

```NAME jan feb mar apr may jun jul aug sep oct nov dec
NAME (1 2 3) ace deuce trey
COPY (2 3 4) vec1
COPY (3 4 5) vec2
COPY (10 15 20) vec3```
 Specification Name Format Example Meaning of Example List (n1 n2 n3…) (1 3 6 2 9) (1.0 3.0 6.0 2.0 9.0) Sequence n1,n2 1,5 5,1 jan,apr vec1,vec2 (1.0 2.0 3.0 4.0 5.0) (5.0 4.0 3.0 2.0 1.0) (jan feb mar apr) (2.0 3.0) n1,n2,n3 2,10,2 1,2,0.1 vec1,vec3,vec2 jan,dec,3 (2 4 6 8 10) (1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9) (2.0 5.0 8.0) illegal Multiple n1#vec 5#3 3#ace 2#(1 2 3) 2#vec1 vec1#vec2 (3.0 3.0 3.0 3.0 3.0) (ace ace ace) (1.0 2.0 3.0 1.0 2.0 3.0) (2.0 3.0 4.0 2.0 3.0 4.0) (3.0 4.0 5.0 3.0 4.0 5.0) Multiple Sequence n1#n2,n3,n4 2#3,5 2#vec1,vec3,vec2 (3.0 4.0 5.0 3.0 4.0 5.0) (2.0 5.0 8.0 2.0 5.0 8.0) Number (n) or n 3.5 (3.5) 3.5E2 (3.5) (3.5) (3500.0) Empty list ( ) ( ) ( )

The "Format" column, where "n", "n1", etc. represent numbers and "vec" represents a vector, shows different generic ways to write a list in Resampling Stats. The fundamental way a list is represented is by a series of numbers separated by one or more spaces and enclosed within parentheses. You use this when there is no particular pattern in the numbers that allows you to use one of the other more compact specification methods. The next three rows in the table show how you generate special lists without having to type in all the numbers. Using the Sequence specification, you enter only the lowest and highest values of a desired sequence separating those two values with a comma. For the Multiple specification, you enter the number of times (n1) that you want another value (n2) or vector (vec) repeated, both separated by a pound sign (#), called the multiple operator. In the Multiple Sequence specification, you specify a sequence on the right side of the pound sign using the sequence operator, the comma. Next, a "number" is shown to be a list with one element. Finally, an empty list is shown. Note that an empty list is not the same as a list whose sole element is zero. An empty list has no elements.