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

Andrea Vezzosi sanzhiyan at gmail.com
Mon Nov 24 01:44:24 EST 2008


On Mon, Nov 24, 2008 at 7:40 AM, Andrea Vezzosi <sanzhiyan at gmail.com> wrote:

> It's more natural to consider the cross product of no sets to be [[]] so
> your crossr becomes:
>
> crossr [] = [[]]
> crossr (x:xs) = concat (map (\h ->map (\t -> h:t) (crossr tail)) hd


Ops, hd and tail should be x and xs here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081124/db41d829/attachment.htm


More information about the Haskell-Cafe mailing list