On 8/11/07, Per Vognsen <[EMAIL PROTECTED]> wrote:
>
> Applicative functors can indeed help:
>
>     (,,,) <$> [1,2,3] <*> [-1,0,1] <*> [1,1,1] <*> [0,2,6]
>
> You just use n-1 commas when you want the effect of zipn.


Actually, that's not quite right, since that uses the applicative functor
related to the list monad (so you get a list of 4-tuples of all possible
combinations, rather than a 4-way zip).  To get the zip behavior, you need
to add a ZipList constructor in front of all the lists, and then apply
getZipList at the end to extract.

-Brent
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to