Recursion 使用递归时Ocaml错误取消绑定值
我的代码非常基本,因为我对ocaml还很陌生 我试图递归调用函数,但在函数名上收到一条未绑定值错误消息Recursion 使用递归时Ocaml错误取消绑定值,recursion,ocaml,Recursion,Ocaml,我的代码非常基本,因为我对ocaml还很陌生 我试图递归调用函数,但在函数名上收到一条未绑定值错误消息 let count_help x a lst = match lst with [] -> a | (s,i)::t -> if s = x then count_help x a+1 t else count_help x a t ;; let count_assoc lst x = count_help x 0 lst ;; 错误是在count\U
let count_help x a lst = match lst with
[] -> a
| (s,i)::t -> if s = x then count_help x a+1 t else count_help x a t
;;
let count_assoc lst x =
count_help x 0 lst
;;
错误是在count\U help中调用count\U help的行上未绑定值count\U help
这段代码只需计算给定字符x的关联出现的次数
let rec count_help ...
允许在其定义中递归使用名称count\u help