小编jla*_*tan的帖子

OCaml:函数输入('a*'b - >'c)

let rec 

map2 (f : 'a * 'b -> 'c) (l1 : 'a list) (l2 : 'b list) : 'c list =
  match (l1,l2) with
    | ([], []) -> []
    | (x::l1),(y::l2) -> f (x, y)::(map2 f (l1, l2))
Run Code Online (Sandbox Code Playgroud)

它正在回归:

Error: This expression has type 'a list * 'a list
   but an expression was expected of type 'a list
Run Code Online (Sandbox Code Playgroud)

我在这做错了什么?

ocaml function

2
推荐指数
1
解决办法
1197
查看次数

标签 统计

function ×1

ocaml ×1