Interarray permutations in Ruby
Contents
I don't really have a better name for this. It's also not completely clean, but it works. I had, almost a year ago (362 days ago), written a blog post about lexicographic permutations. That was about permutations of elements within one array. Someone on rubyforum asked about permutations between multiple arrays. I found something in C#, which I was happy to transcribe to Ruby and tweak a little.


So, we get this:


Magic!
 Edit  of course, my solution is hackish, and someone came up with a quicker and more elegant solution:


This gives the same result as above.
Author Aldric Giacomoni
LastMod 20091217