2008/11/23 Larry Evans <[EMAIL PROTECTED]>: > http://www.muitovar.com/monad/moncow.xhtml#list > > contains a cross function which calculates the cross product > of two lists. That attached does the same but then > used cross on 3 lists. Naturally, I thought use of > fold could generalize that to n lists; however, > I'm getting error:
You should try writing this yourself, it would be a good exercise. To begin with, you can mimic the structure of cross in that tutorial, but make it recursive. After you have a recursive version, you might try switching to fold or foldM. The type of the function will not involve tuples, since they can be arbitrary length (dynamic-length tuples are not supported in Haskell; we use lists for that). cross :: [[a]] -> [[a]] ... Good luck, Luke _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe