@J.Salle Uh, the result should be approximately (1 1 1) 4 5 (6 6) (7 7) 3
(except each element should be a vector). ⊆
will do the enclosing for you, you just need to tell it where the partitions begin, i.e. where list changes. So, for strictly positive ascending integers, you can just do ⊆⍨
but how about numbers in general? Actually, now I realise that my solution will only work on ascending numbers (i.e. even non-ints), but only when sorted. Never mind.