> Out of curiosity, do you have a good solution without the use of a lambda? > "pure SO APL" if you like.
I don't know how to do it in GNU APL. In Dyalog you can play silly games with ∘ (function composition) and ⍨, e.g.: ⎕ML←1 ⍝ ↑ is mix and ↓ is split ↑(⌷⍨∘(⊂∘⍋))⍨¨↓X ⍝ N.B. ⍵[⍋⍵] ←→ (⊂⍋⍵)⌷⍵ xz xz ab ab (Dyalog version 14, currently in beta release, supports the rank operator so you will be able to use it instead of split and mix.) Jay.