a2

The \ Function: Expand

Monadic (One-Argument) Form

See Scan later in this chapter under APL Operators.

Dyadic (Two-Argument) Form: Expand A\[I1 B or A\B or A+B

The result of the expand function is argument B expanded as indicated by

argument A. Each 1 in argument A selects an

element from argument B and each

0 in argument A inserts a 0 (or blank for character data) in the result. Argument A

must be a logical scalar or vector having the values 0 or 1. Argument B can be any

scalar, vector, or other array. If argument B is a scalar or vector, argument A must

have the same number of 1's as the number of elements in argument B. If

argument B is an array, argument A must have the same number of 1's as the length

of the argument B coordinate being acted on.

When argument B is an

array, the [I] index entry is used to specify the coordinate

that is acted on. If the index entry is omitted, the last coordinate (columns) is

assumed. If the A+B is used, then the first coordinate is assumed.

The rank of the result is the same as the rank of the B argument:

1. (I :I. 1 0 \ 1 2 3

B4-2 3p1 a 3 4 5 b

B

10230

1. 2 3

1.t s (5

1 2 3

000

4- 5 ci

I. 0 1\C1JB

The first coordinate (rows) is

expanded; a row is inserted be-

tween the first and second row.

1. 10 l\c2:JB

1203 2

The second coordinate (columns) is

1.c 5 0 cs - expanded; a column is inserted

1 0 I \I3 between the second and third columns.

1. 2 3

000

4 s 6

The \ Function: Expand

Monadic (One-Argument) Form

See Scan later in this chapter under APL Operators.

Dyadic (Two-Argument) Form: Expand A\[I1 B or A\B or A+B

The result of the expand function is argument B expanded as indicated by

argument A. Each 1 in argument A selects an

element from argument B and each

0 in argument A inserts a 0 (or blank for character data) in the result. Argument A

must be a logical scalar or vector having the values 0 or 1. Argument B can be any

scalar, vector, or other array. If argument B is a scalar or vector, argument A must

have the same number of 1's as the number of elements in argument B. If

argument B is an array, argument A must have the same number of 1's as the length

of the argument B coordinate being acted on.

When argument B is an

array, the [I] index entry is used to specify the coordinate

that is acted on. If the index entry is omitted, the last coordinate (columns) is

assumed. If the A+B is used, then the first coordinate is assumed.

The rank of the result is the same as the rank of the B argument:

1. (I :I. 1 0 \ 1 2 3

B4-2 3p1 a 3 4 5 b

B

10230

1. 2 3

1.t s (5

1 2 3

000

4- 5 ci

I. 0 1\C1JB

The first coordinate (rows) is

expanded; a row is inserted be-

tween the first and second row.

1. 10 l\c2:JB

1203 2

The second coordinate (columns) is

1.c 5 0 cs - expanded; a column is inserted

1 0 I \I3 between the second and third columns.

1. 2 3

000

4 s 6