Drop R←X↓Y

Y may be any array. X must be a simple scalar or vector of integers. If X is a scalar, it is treated as a one-element vector. If Y is a scalar, it is treated as an array whose shape is (⍴X)⍴1. After any scalar extensions, the shape of X must be less than or equal to the rank of Y. Any missing trailing items in X default to 0.

R is an array with the same rank as Y but with elements removed from the vectors along each of the axes of Y. For the Ith axis:

  • if X[I] is positive, all but the first X[I] elements of the vectors result
  • if X[I] is negative, all but the last X[I] elements of the vectors result

If the magnitude of X[I] exceeds the length of the Ith axis, the result is an empty array with zero length along that axis.

Examples

      4'OVERBOARD'
BOARD

      ¯5'OVERBOARD'
OVER

      10'OVERBOARD'
0

      M
ONE
FAT
FLY
      0 ¯2M
O
F
F

      ¯2 ¯1M
ON
      1M
FAT
FLY
      M32 3 4⎕A

      1 1M3
QRST
UVWX
      ¯1 ¯1M3
ABCD
EFGH