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

Brent Yorgey byorgey at gmail.com
Sat Aug 11 11:02:17 EDT 2007

On 8/11/07, Frank Buss <fb at frank-buss.de> wrote:
> 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 there are functions like zip5 and
> not
> just zipn?

Template Haskell can also be used to generate appropriate code for zipn (in
fact, the original paper on TH even uses this as an example [1]).  But
again, this approach only works if the value of n is known at compile time.


[1] http://www.haskell.org/th/papers/meta-haskell.ps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070811/0f2ae86b/attachment.htm

More information about the Haskell-Cafe mailing list