⊃ — Mix / Pick
Function. Keys: Alt-x. Ranks: 0 monadic, 1 ∞ dyadic
⊃Y assembles items into rectangular cells, padding to a common shape with fill.
⊃1 2 3 ⍝ 1 2 3
⊃[[1 2] [3 4 5]] ⍝ [1 2 0⋄3 4 5]The result keeps the keys and axis names that the cells agree on. A cell without keys or a name agrees with any, as in arithmetic. An axis that needs padding loses its keys.
⊃[10 20;["a":1 "b":2]] ⍝ ["a":10 "b":20⋄"a":1 "b":2]P⊃Y selects at coordinates P along the leading axes. With fewer coordinates than axes, the result is the cell made of the remaining axes. With a coordinate for every axis, the result is the stored value. Successive Picks traverse nesting. Empty coordinates return Y.
1⊃2 3⍴⍳6 ⍝ 3 4 5
1 1⊃2 3⍴⍳6 ⍝ 4
0⊃1⊃[[1 2] [3 4]] ⍝ 3
⍬⊃1 2 ⍝ 1 2Array-valued coordinate fields pair using leading-axis agreement:
[0 2;1 3]⊃3 4⍴⍳12 ⍝ 1 11Coordinate fields may use strings on keyed axes.
T←["price":1 2 3;"qty":4 5 6]
"qty"⊃T ⍝ 4 5 6
[["qty" "price"]]⊃T ⍝ [[4 5 6] [1 2 3]]With axes, ⊃⍠A Y places the cell axes of Mix among the frame axes. See Axis. On Pick, negative positions count from the end. Position 0 or ¯1 on an empty axis gives fill, as does First.
Inverse
⊃⁻¹Y splits Y into its major cells.
⊃⁻¹[1 2⋄3 4] ⍝ [1 2;3 4]Errors
RANK: Mix axes not a unit or vectorLENGTH: Mix axis count not the cell rankINDEX: position outside the array, or Mix axis outside the resultDOMAIN: repeated or fractional Mix axes