Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created January 21, 2015 11:43
Show Gist options
  • Save shigemk2/a8815778adc767219d71 to your computer and use it in GitHub Desktop.
Save shigemk2/a8815778adc767219d71 to your computer and use it in GitHub Desktop.
zipWith' :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith' _ [] _ = []
zipWith' _ _ [] = []
zipWith' f (x:xs) (y:ys) = f x y : zipWith' f xs ys
main = do
print $ zipWith' (+) [4,2,5,6] [2,4,1,0]
print $ zipWith' max [4,2,5,6] [2,4,1,0]
print $ zipWith' (*) (replicate 5 2) [1..]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment