1
我试图写计数n的最多M个除数(其中电流是除数的数目的函数除数和计数是迄今为止的除数总数)ocaml的错误消息错误:解析错误:“在”预期后[结合](在[EXPR])
我得到错误错误:解析错误:“in”预计在[binding](在[expr]中)代码的最后一行,但我不希望真的看不到“如何”成为最后一行。我在这里做错了什么?
(* Counts the number of divisors*)
let rec count_divisors (n: int) (m: int) (current: int) (count: int): int =
if count > m || current > n then count
else if (n mod current) = 0 then count_divisors n m (current+1) (count+1)
else (count_divisors n m (current+1) count);;