Split (↓
) is a monadic primitive function which reduces the rank of its argument by converting one of its axes to one level of nesting. The axis to move defaults to the last axis, but a different axis can be chosen using function axis. It shares its glyph ↓
with the dyadic function Drop. Split is a right inverse to Mix.
Examples
The result of Split on a non-scalar array is always a nested array whose elements are vectors. The rank of ↓[K]Y
is ¯1+≢⍴Y
(original rank minus 1), its shape is (K≠⍳≢⍴Y)/⍴Y
(original shape with K-th axis removed), and the shape of each element is (⍴Y)[K]
.
⎕←Y←2 3 4⍴⎕A ⍝ 3D array
ABCD
EFGH
IJKL
MNOP
QRST
UVWX
↓Y ⍝ Last axis split; 2×3 array of length-4 vectors
┌────┬────┬────┐
│ABCD│EFGH│IJKL│
├────┼────┼────┤
│MNOP│QRST│UVWX│
└────┴────┴────┘
↓[2]Y ⍝ 2nd axis split; 2×4 array of length-3 vectors
┌───┬───┬───┬───┐
│AEI│BFJ│CGK│DHL│
├───┼───┼───┼───┤
│MQU│NRV│OSW│PTX│
└───┴───┴───┴───┘
↓↓Y ⍝ Split twice
┌────────────────┬────────────────┐
│┌────┬────┬────┐│┌────┬────┬────┐│
││ABCD│EFGH│IJKL│││MNOP│QRST│UVWX││
│└────┴────┴────┘│└────┴────┴────┘│
└────────────────┴────────────────┘
(≡Y)(≢⍴Y) ⍝ Original array is depth 1, rank 3
1 3
(≡↓Y)(≢⍴↓Y) ⍝ Split array is depth 1+1, rank 3-1
2 2
Split is a no-op to a scalar.
2≡↓2
1
External links
Lessons
Documentation
APL built-ins [edit]
|
Primitives (Timeline) |
Functions
|
Scalar
|
Monadic
|
Conjugate ∙ Negate ∙ Signum ∙ Reciprocal ∙ Magnitude ∙ Exponential ∙ Natural Logarithm ∙ Floor ∙ Ceiling ∙ Factorial ∙ Not ∙ Pi Times ∙ Roll ∙ Type ∙ Imaginary ∙ Square Root ∙ Round
|
Dyadic
|
Add ∙ Subtract ∙ Times ∙ Divide ∙ Residue ∙ Power ∙ Logarithm ∙ Minimum ∙ Maximum ∙ Binomial ∙ Comparison functions ∙ Boolean functions (And, Or, Nand, Nor) ∙ GCD ∙ LCM ∙ Circular ∙ Complex ∙ Root
|
Non-Scalar
|
Structural
|
Shape ∙ Reshape ∙ Tally ∙ Depth ∙ Ravel ∙ Enlist ∙ Table ∙ Catenate ∙ Reverse ∙ Rotate ∙ Transpose ∙ Raze ∙ Mix ∙ Split ∙ Enclose ∙ Nest ∙ Cut (K) ∙ Pair ∙ Link ∙ Partitioned Enclose ∙ Partition
|
Selection
|
First ∙ Pick ∙ Take ∙ Drop ∙ Unique ∙ Identity ∙ Stop ∙ Select ∙ Replicate ∙ Expand ∙ Set functions (Intersection ∙ Union ∙ Without) ∙ Bracket indexing ∙ Index ∙ Cartesian Product ∙ Sort
|
Selector
|
Index generator ∙ Grade ∙ Index Of ∙ Interval Index ∙ Indices ∙ Deal ∙ Prefix and suffix vectors
|
Computational
|
Match ∙ Not Match ∙ Membership ∙ Find ∙ Nub Sieve ∙ Encode ∙ Decode ∙ Matrix Inverse ∙ Matrix Divide ∙ Format ∙ Execute ∙ Materialise ∙ Range
|
Operators |
Monadic
|
Each ∙ Commute ∙ Constant ∙ Replicate ∙ Expand ∙ Reduce ∙ Windowed Reduce ∙ Scan ∙ Outer Product ∙ Key ∙ I-Beam ∙ Spawn ∙ Function axis ∙ Identity (Null, Ident)
|
Dyadic
|
Bind ∙ Compositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner Product ∙ Determinant ∙ Power ∙ At ∙ Under ∙ Rank ∙ Depth ∙ Variant ∙ Stencil ∙ Cut ∙ Direct definition (operator) ∙ Identity (Lev, Dex)
|
Quad names
|
Index origin ∙ Comparison tolerance ∙ Migration level ∙ Atomic vector
|