我正在尝试编写一个divide函数(作为合并排序的一部分),该函数接受一个列表并返回两个长度大致相同的列表。我想使用List.length()函数来完成此操作。list
but an expression was expected of type 'b list * 'c list 我不明白为什么transRec h :: l1 tail被认为是一个列表
a :: compress tval compress : 'a list -> 'a list = <fun>例如,大小写在哪里?是smaller -> smaller吗?我知道smaller是一个变量,或者是一个标识符,但是它返回了什么(在OCaml中返回正确的术语是为了这里发生的事情)?我知道<e
我想实现 函数使用 ,这是我尝试过的: let rec assoc lista x = match lista with | (a,b)::llet ind = find l1 (List.find (fun s -> compare a x = 0)) | [] -> raise Not_found
| h :: t -> if x = h then 0