Re: [Haskell-cafe] Re: zip3, zip4 ... -> zipn?

2007-08-13 Thread Brent Yorgey
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 relat

Re: [Haskell-cafe] Re: zip3, zip4 ... -> zipn?

2007-08-11 Thread Marc Weber
> Also, applicative functors can help > > GHCi> :m +Control.Applicative > GHCi> (\x y z -> x*(y+z)) <$> ZipList [1,2,3] > <*> ZipList [-1,0,1] <*> ZipList [1,1,1] > ZipList [0,2,6] > GHCi> http://www.soi.city.ac.uk/~ross/papers/Applicative.pdf quote "The general scheme is as follow

[Haskell-cafe] Re: zip3, zip4 ... -> zipn?

2007-08-11 Thread Chung-chieh Shan
Frank Buss <[EMAIL PROTECTED]> wrote in article <[EMAIL PROTECTED]> in gmane.comp.lang.haskell.cafe: > Is it possible to write a function like this: > > zipn n list_1 list_2 list_3 ... list_n > > which implements zip3 for n=3, zip4 for n=4 etc.? Looks like variable number > of arguments are poss

Re: [Haskell-cafe] Re: zip3, zip4 ... -> zipn?

2007-08-11 Thread Per Vognsen
On 8/11/07, apfelmus <[EMAIL PROTECTED]> wrote: > Frank Buss schrieb: > > Is it possible to write a function like this: > > > > zipn n list_1 list_2 list_3 ... list_n > > > > which implements zip3 for n=3, zip4 for n=4 etc.? Looks like variable number > > of arguments are possible, like printf show

[Haskell-cafe] Re: zip3, zip4 ... -> zipn?

2007-08-11 Thread apfelmus
Frank Buss schrieb: Is it possible to write a function like this: zipn n list_1 list_2 list_3 ... list_n which implements zip3 for n=3, zip4 for n=4 etc.? Looks like variable number of arguments are possible, like printf shows, so a general zipn should be possible, too. If it is possible, why t