Let's say I have the following input array of arrays:
[[1],[2,3],[4,5],[6]]
I'd like to produce all permutations like this:
[[1,2,4,6],[1,2,5,6],[1,3,4,6],[1,3,5,6]]
What's a nice Ruby way of doing this? Or really any way of doing this? I feel like there's an elegant solution that I can't see.