why the lucky stiff wrote:

>  >> (foo * bar.length).sort.zip(bar * bar.length)

With

foo = %w(one two three four)
bar = [6, 7, 8]

the result is

[["four", 6], ["four", 7], ["four", 8], ["one", 6], ["one", 7],
 ["one", 8], ["three", 6], ["three", 7], ["three", 8], ["two", nil],
 ["two", nil], ["two", nil]]

so it should be

(foo * bar.length).sort.zip(bar * foo.length)

However, if foo isn't already sorted, the order of its elements is
changed.