↑ — First / Take

Function. Keys: Alt-k. Ranks: ∞ monadic, 1 ∞ dyadic

↑Y returns the first major item, like 0⊃Y. On an enclosure it returns the contained value. An empty leading axis gives a cell of fill.

↑[[1 2] [3 4 5]]  ⍝ 1 2
↑2 3⍴⍳6           ⍝ 0 1 2
↑⊂7               ⍝ 7
↑0 3⍴0            ⍝ 0 0 0

N↑Y takes leading items; negative N takes from the end. Overtake inserts fill.

4↑1 2              ⍝ 1 2 0 0
¯4↑1 2             ⍝ 0 0 1 2

Vector counts apply to successive leading axes. N↑⍠K Y applies the counts to axes K.

1 2↑2 3⍴⍳6         ⍝ 1 2⍴0 1

Inverse

↑⁻¹Y encloses Y.

↑⁻¹5   ⍝ ⊂5