Compute a massive array on an array of arrays
To compute Cartesian product in Ruby can be used Array#product
as syntax if I have an array of arrays and want to compute the product?
[[1,2],[3,4],[5,6]] => [[1,3,5], [2,3,5], ...]
I'm not sure, because the Ruby documentation product
defines a method with an arbitrary number of arguments, so just pass arrays of arrays as an argument, like this:
[].product(as) => [
lacks. How can I solve this?
+3
source to share