in reply to Re: sending a scalar to the interpreter as a command
in thread sending a scalar to the interpreter as a command
Thanks for your quick response, David. I really appreciate it.
I would actually prefer to solve the problem without resorting to eval just as you have recommended. But, for some reason, I just can't quite wrap my head around how to do it. Maybe you or someone else can help.
What I have is a two-dimensional array filled with scores. That looks something like this:
67 42 99 28 15 14 92 12 45 57 16 41 99 67 28 15 57 12 45 14 92 12 92 42 67 28 15 45 57 16 12 99 14
The array can be varying widths and heights. In other words, there are variable numbers of rows and columns.
What I want to do is find all the possible combinations when taking one item from each row. I believe there are x^y possible combinations where x represents the number of rows and y represents the number of columns. What I want is this: 67-41-92, 67-41-42, 67-41-67, 67-41-28 ...
I believe it's just a matter of nesting arrays. The trick is setting up a dynamic number of these. I played around with the idea of using a while loop, but the problem is that this resulted in consecutive iterations through the arrays, not nested iterations.
So I'm really at a loss at this point. If anyone can help, I'd be very grateful.
Thanks,
|
|---|