Integer Interpretator
Python 2, 50 bytes
l=input()
while l:s=set(l);print s;map(l.remove,s)
Try it online!
Repeatedly prints the unique of elements of the list, then removes one of each such element. A rare imperative use of map
.
Haskell, 39 bytes
First we collect all equal elements in separate lists using sort
and then group
. By transpose
ing the resulting list of lists we get at most one of each of those elements in the resulting lists.
import Data.List
f=transpose.group.sort
Try it online!
Example
[1,2,3,2,4,2,1,5] --input
sort$[1,2,3,2,4,2,1,5] --[1,1,2,2,2,3,4,5]
group.sort$[1,2,3,2,4,2,1,5] --[[1,1],[2,2,2],[3],[4],[5]]
transpose.group.sort$[1,2,3,2,4,2,1,5] --[[1,2,3,4,5],[1,2],[2]]
Jelly, 3 bytes
ĠZị
A monadic Link accepting a list, which yields a shortest set-wise partition such that each part is a set.
Try it online!
How?
ĠZị - Link: list, L e.g. [8,2,4,2,9,4,1]
Ġ - group indices of L by their values [[7],[2,4],[3,6],[1],[5]]
Z - transpose [[7,2,3,1,5],[4,6]]
ị - index into L [[1,2,4,8,9],[2,4]]