[英]Haskell map function for two lists
I need to apply a function to two lists.我需要将 function 应用于两个列表。 The map function is
map:: (a->b) -> [a] -> [b]
, however I need something more like map2:: (a->b->c) -> [a] -> [b] -> [c]
. map function 是
map:: (a->b) -> [a] -> [b]
map2:: (a->b->c) -> [a] -> [b] -> [c]
。 Is there a prelude function similar to map
that can do this?有没有类似
map
的前奏function可以做到这一点?
You can find such function by hoogling (a -> b -> c) -> [a] -> [b] -> [c]
.您可以通过hoogling
(a -> b -> c) -> [a] -> [b] -> [c]
找到这样的 function 。 Yes, it's called zipWith
.是的,它被称为
zipWith
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.