
On 07/26/2005 07:25 AM, David Abrahams wrote:
Alex Mendes da Costa <alexmdac@gmail.com> writes:
The iterator that I am proposing would provide the sequence (1,10), (2,10), (1,20), (2,20).
Oh, you want a cross-product iterator. Interesting idea.
BTW, the J or apl term for this would be "outer-product" (produced with '/' operator) applied to the "append" operator (','): ,/ IOW: 1 2 ,/ 10 20 produces: 1 10 2 10 1 20 2 20 With another operator, for example, '+' instead of ',', the result would be: 11 12 21 22 See "outer-product" on p.7 of: http://www.jsoftware.com/books/pdf/brief.pdf IOW, Alex's proposal is equivalent to J's: S1 ,/ S2 except the J result is a matrix instead of a vector, AFAICT. J uses the term "inner-product"[p.20] applied to '+' and '*' operators for "matrix-product" or "cross-product". ("cross product" doesn't occur in above pdf). A google search for outer product result in several different definitions :(