Haskell : Zippers with zippers

Haskell ZipWithN in termas of zipWithN-1:
zip’ :: [a]->[b]->[(a,b)]
zip’ xs ys = zipWith (\x y -> (x,y) ) xs ys

zipWith3′ :: (a->b->c->d)->[a]->[b]->[c]->[d]
zipWith3′ f xs = zipWith id . zipWith f xs

zipWith4′ :: (a->b->c->d->e)->[a]->[b]->[c]->[d]->[e]
zipWith4′ f xs = zipWith3′ id . zipWith f xs

zipWith5′ :: (a->b->c->d->e->f)->[a]->[b]->[c]->[d]->[e]->[f]
zipWith5′ f xs = zipWith4′ id . zipWith f xs

zipWith6′ :: (a->b->c->d->e->f->g)->[a]->[b]->[c]->[d]->[e]->[f]->[g]
zipWith6′ f xs = zipWith5′ id . zipWith f xs

zipWith7′ :: (a->b->c->d->e->f->g->h)->[a]->[b]->[c]->[d]->[e]->[f]->[g]->[h]
zipWith7′ f xs = zipWith6′ id . zipWith f xs

zipWith8′ :: (a->b->c->d->e->f->g->h->i)->[a]->[b]->[c]->[d]->[e]->[f]->[g]->[h]->[i]
zipWith8′ f xs = zipWith7′ id . zipWith f xs

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s