简体   繁体   English

Haskell map function 用于两个列表

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM