如何在Haskell中创建递归zipWith函数?

use*_*042 0 recursion haskell function list

到目前为止,我有:

miZipWith f [] [] = []
miZipWith f (x:xs) [] = []
miZipWith f [] (y:ys) = []
miZipWith f (x:xs) (y:ys) = f y: miZipWith f xs ys

----miZipWith f (x:xs) (y:ys) = f x : f y : miZipWith f xs ys
Run Code Online (Sandbox Code Playgroud)

但这只是用第二个列表"拉上"函数f.我如何包含第一个列表?

*Main> miZipWith (*2) [1,2,3,4] [5,6,1]
[10,12,2]
Run Code Online (Sandbox Code Playgroud)

The*_*net 5

zipWith功能是这样的:

zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith f (x:xs) (y:ys) = f x y : zipWith f xs ys
zipWith _ _ _ = []
Run Code Online (Sandbox Code Playgroud)

你的假设是函数f只接受一个参数,但它实际上需要两个参数(两个列表的头部).