With vectors of the same length, use the inner product:
1 2 3,.,40 50 60
┌──────────────┐
│1 40 2 50 3 60│
└──────────────┘
Building on top of this spawns this dfn:
{r←(⍴⍺)⌊⍴⍵⋄(∊(r⍴⍺),.,r⍴⍵),(r↓⍺),r↓⍵}
alternatively, we can laminate (keeping the general logic):
{r←(⍴⍺)⌊⍴⍵⋄(,(r⍴⍺),⍪r⍴⍵),(r↓⍺),r↓⍵}
source
share