[Haskell-cafe] Re: howto tuple fold to do n-ary cross product?

Daniel Fischer daniel.is.fischer at web.de
Sun Nov 30 13:39:41 EST 2008


Am Sonntag, 30. November 2008 19:04 schrieb Larry Evans:
> > If you're asking whether crossn, as a single function which handles
> > arbitrarily many arguments, can be defined, the short answer is "no".
> > I dare you to come up with a case in which such function adds more
> > than cursory convenience.
>
> The following post:
>
>    http://thread.gmane.org/gmane.comp.lib.boost.devel/182797
>
> shows at least one person that would find it useful, at least in
> c++.  Of course maybe it would be less useful in haskell.
>

And having

genericCross xs1 xs2

being able to be
[(x,y) | x <- xs1, y <- xs2]
\xs3 -> cross3 xs1 xs2 xs3
\xs3 xs4 -> cross4 xs1 xs2 xs3 xs4
...

would open up the possibility for a great number of bugs, I believe.


More information about the Haskell-Cafe mailing list