在 F# 中,map2 如何处理不均匀的列表长度?

In F#, how does map2 handle uneven list lengths?

map2函数如何处理长度不等的列表?

例如

let list1 = [1; 2; 3]
let list2 = [4; 5; 6; 7]
let sumList = List.map2 (fun x y -> x + y) list1 list2
printfn "%A" sumList

the documentation 中没有提到这一点似乎很奇怪。

即使文档没有引用它,也可以轻松查看 source code 以了解发生了什么和实现细节。

正如您在 link 中看到的那样,当您传递不同大小的列表时,将调用 invalidArg,抛出一个 ArgumentException 以及 [=11] 中存储的消息=] 资源.