| Behead | }. _ 1 _ | Drop |
|
}. drops the leading item of its argument.
|
x }. y drops (at most) |x items from y,
dropping from the front if x is positive and from the tail
if negative. In general, if y is not an atom, x may be a list of length at most r=:$$y, and the effect of element k is (k{x) }."(r-k) y; if y is an atom, the result is (0=x)$y . |
]y=: a. {~ (a. i. 'A') + i. 4 5
ABCDE
FGHIJ
KLMNO
PQRST
f=: }. ; {.
f y
+-----+-----+
|FGHIJ|ABCDE|
|KLMNO| |
|PQRST| |
+-----+-----+
g=: }. ,.@; {.
g y
+-----+
|FGHIJ|
|KLMNO|
|PQRST|
+-----+
|ABCDE|
+-----+
(2}.y) ; (_2}.y) ; (6}.y) ; ($ 6}.y) ; (}."1 y) ; (3}."1 y)
+-----+-----+-----+---+----+--+
|KLMNO|ABCDE| |0 5|BCDE|DE|
|PQRST|FGHIJ| | |GHIJ|IJ|
| | | | |LMNO|NO|
| | | | |QRST|ST|
+-----+-----+-----+---+----+--+