From: Jeff Collins Date: 2012-04-15T08:54:41+09:00 Subject: Creating an array containing sums of combinations of ranges I've got a puzzle I haven't been able to solve. I have two user-provided arrays that look something like this: [1..2, 2..3] and [2, 3] I need to produce an array containing every possible sum of the ranges multiplied by the corresponding member of the second array. i.e. if the first array is [n, m] and the second array is [x, y], I need an array containing every possible (nx + my). Normally I'd do a couple of nested loops, but I need the arrays can be of arbitrary lengths. How should I go about this? -- Posted via http://www.ruby-forum.com/.