
On 11/23/08 11:43, George van Venrooij wrote:
Larry Evans wrote:
Judging from the "what is it?" on that tinyurl, it is the cross product of the mplbook's exercise 7-8 mentioned in my previous post.
It indeed has similar behavior when feeding it 2 sequences as the cross product, or to be more precise, an outer product (as you mentioned earlier) since both sequences need not have the same length.
Looking at Wikipedia's definition: http://en.wikipedia.org/wiki/Outer_product then my algorithm produces the outer product when called with 2 sequences. When called with 3 sequences, it generates some kind of 3-way outer product that I am not able to find a good name or definition for. In the cross.zip file mentioned in my previous post and located here:
http://www.boostpro.com/vault/index.php?PHPSESSID=ab51206c9d980155d142f5bcef8e00ee&direction=0&order=&directory=Template%20Metaprogramming you can see cross.out, which contains the output from a sort of 3 way outer product which seems like just an outer product of of a sequence and a previous outer product. IOW, a fold of cross over a sequence of sequences should result in an n-way outer product. I haven't tried it yet; however, it should be very simple to do in cross.hs since haskell already has a fold function.