I got this list of lists:
[[1, 2, 3], [4, 5], [6]] = listOf(listOf(1,2,3), listOf(4,5), listOf(6))
If I'm using the flatten method, the result would be:
[1, 2, 3, 4, 5, 6] = listOf(1,2,3,4,5,6)
The output I want would be kind of round robin flatten taking the first N elements of each list for flattening...
So if N=1:
[1, 4, 6, 2, 5, 3]
if N=2:
[1, 2, 4, 5, 6, 3]
if N=3:
[1, 2, 3, 4, 5, 6]
I suppose it is achievable by using some mutable lists but it would be pretty ugly and not functional at all.