#APL 25# 1↓¨(1,∨⌿<\2=+\∘.=⍨a)⊂1,a← Example: ]display 1↓¨(1,∨⌿<\2=+\∘.=⍨a)⊂1,a←2 1 1 2 3 2 2 4 5 6 7 3 7 0 5 ┌→──────────────────────────────────────┐ │ ┌→──┐ ┌⊖┐ ┌→────────────┐ ┌⊖┐ ┌→┐ ┌⊖┐ │ │ │2 1│ │0│ │3 2 2 4 5 6 7│ │0│ │0│ │0│ │ │ └~──┘ └~┘ └~────────────┘ └~┘ └~┘ └~┘ │ └∊──────────────────────────────────────┘ ***Old One:*** {1↓¨(1,(⍳⍴⍵)∊,{1↑1↓⍵}⌸⍵)⊂1,⍵} This is a nice question for the key operator (⌸) which was introduced with Dyalog APL v14. It takes the left argument function ({1↑1↓⍵}) and gives it for each unique argument, the indices in the vector for that argument. Here I'm taking the second index, then i check which of the indices is present in this list ((⍳⍴⍵)∊) and use the resulting boolean for splitting the original vector. Can be tried online here: [http://tryapl.org][1] [1]: http://tryapl.org/