
On 03/15/08 08:26, Larry Evans wrote:
On 03/12/08 20:21, Max Motovilov wrote: [snip]
Second, while recursive implementation is very similar to the iterative, it still generates the combinations in reverse order :) Not important for applications I can think of, but still.
*Maybe* one application would be matrix multiplication where the shape is known but the values aren't. Then the outer product of n domains, where each domain is range_c<0,size_rank> where size_rank is the size of the rank-th dimension of the array, would produce an matrix of the indices's into row of the left matrix and column of the right matrix.... Sorry, that explanation is getting too complicated, but anyway, the order would be important in this case.
Also, instead of a flatten'ed list, I think the cross_product should produce a nested list where the depth of nesting is the number of domains. IOW, given two domains, a matrix would be produced. Given n-domains, an array of rank n would be produced. At least I *think* that's what apl does.