Skip to content

Instantly share code, notes, and snippets.

@vlastachu
Created March 8, 2016 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vlastachu/18d2492b3ac5da3e7682 to your computer and use it in GitHub Desktop.
Save vlastachu/18d2492b3ac5da3e7682 to your computer and use it in GitHub Desktop.
version of zipWith with number of iteration
zipWithIterNum :: (Integer -> a -> b -> c) -> [a] -> [b] -> [c]
zipWithIterNum fun l r = zipWithIterNum' 0 l r
where n = length l
zipWithIterNum' _ [] _ = []
zipWithIterNum' _ _ [] = []
zipWithIterNum' i (x:xs) (y:ys) = (fun i x y):(zipWithIterNum' (i + 1) xs ys )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment