Topic: `APLX Help` : `Help on APL language` : `APL Primitives` : `↓ Drop`
[ Previous | Next | Contents | Index | APL Home ]

# `↓` Drop

The number of elements specified in the left-hand argument are dropped from the right-hand argument. If the left-hand argument is positive, the elements are dropped from the left-hand end, if negative, from the right-hand end. The result is the original data without the dropped elements.

```             4 ↓ 'A.S.FREEMAN'       (Drops the first 4 characters)
FREEMAN
¯6 ↓ 'A.S.FREEMAN'      (Drops the last 6 characters)
A.S.F
3 ↓ 22 2 19 12          (Drops the first 3 numbers)
12
¯1 ↓ 22 2 19 12         (Drops the last number)
22 2 19
```

If the left argument specifies more elements than the right argument contains, all elements are dropped:

```             5 ↓ 40 92 11
```

The result is in fact an empty vector, as we see if we apply `⍴` to the result:

```             ⍴ 5 ↓ 40 92 11
0
```

If the right argument is a matrix, the first number in the left argument specifies the number of rows to be dropped, and the second, the number of columns:

```             TABLE ← 4 3 ⍴ ⍳ 12
TABLE
1  2  3
4  5  6
7  8  9
10 11 12
2 0 ↓ TABLE               (Drops the first two rows, but NO
7  8  9                        columns)
10 11 12
¯3 0 ↓ TABLE             (Drops the last three rows)
1 2 3
1 2 ↓ TABLE              (Drops the first row and the first
6                              two columns)
9
12
```

Similar considerations apply to higher dimension arrays. Drop may be used for selective specification.

## Drop with axis

Drop used with the axis operator will drop only from the axes specified. Any axis not specified by the axis operator remains unchanged. Each successive element of the left argument indicates how many items to drop from the corresponding axis within the axis specification (and from which end).

```             MAT
1  2  3  4
5  6  7  8
9 10 11 12
2↓[1]MAT                (Drop the first 2 members of the first
9 10 11 12                   dimension, the rows, and leave the number
of columns unchanged)
3↓[2]MAT                (Drop first 3 columns, the second dimension)
4
8
12
```

Topic: `APLX Help` : `Help on APL language` : `APL Primitives` : `↓ Drop`
[ Previous | Next | Contents | Index | APL Home ]