Hi,

I’m trying to remove a array layer implied by multiple Array#product

## Here is the code

## def calculate ranges

prod = ranges.shift

ranges.each { |r| prod = prod.product® }

puts prod.to_s

end

## There is the input

## ranges = [

[[‘a’, ‘b’], [‘c’, ‘d’]],

[[‘e’, ‘f’], [‘g’, ‘h’]],

[[‘i’, ‘j’], [‘k’, ‘l’]]

]

Here is what i do get

## [

[[[“a”, “b”], [“e”, “f”]], [“i”, “j”]],

[[[“a”, “b”], [“e”, “f”]], [“k”, “l”]],

…

]

## And there is what i wish

[

[[“a”, “b”], [“e”, “f”], [“i”, “j”]],

[[“a”, “b”], [“e”, “f”], [“k”, “l”]],

…

]

Probably a silly question, but it’s driving me mad.

I tried flatten, prod = prod[0], using Array#permutation, …

Can’t find my way out…???

Thanks