Is there anything like an inverse of the flatten f...
# getting-started
s
Is there anything like an inverse of the flatten function for a list? I want to take a list and turn it into a list of pairs (0, 1), (2,3) .. etc
r
maybe using chunked?
Copy code
val list = listOf(1, 2, 3, 4)
val chunked = list.chunked(2) // [[1, 2], [3, 4]]
❤️ 4
s
That's perfect, thanks!
🙌 1