Rank/Atop
This feature is implemented via several internal magic functions:
Monadic Derived Function
∇ Z←(LO F X) R;O
[1] X←1⍴X
[2] O←⍴⍴R
[3] X←(-O)⌈O⌊X
[4] Z←LO¨⊂[⍳-X]R⋄→0
[5] ⎕PROTOTYPE:Z←⊃LO¨¨⊂[⍳-X]¨0⍴⊂R
∇
Dyadic Derived Function
∇ Z←L (LO F X) R;O
[1] X←1↓⌽3⍴⌽X
[2] O←(⍴⍴L),⍴⍴R
[3] X←(-O)⌈O⌊X
[4] Z←(⊂[⍳-1↑X]L)LO¨⊂[⍳-1↓X]R⋄→0
[5] ⎕PROTOTYPE:Z←⊃(⊂[⍳-1↑X]¨0⍴⊂L)LO¨¨⊂[⍳-1↓X]¨0⍴⊂R
∇
Both of the above functions implement their respective derived function except for some final processing which is essentially a disclose but one which allows for mismatched ranks. That part is implemented by the following function where L has already been calculated as the maximum rank across all items:
Internal Conform Function
∇ Z←L F R
[1] Z←⊃(((L-∊⍴∘⍴¨R)⍴¨1),¨⍴¨R)⍴¨R
∇