我的代码非常基础,因为我对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
;;
Run Code Online (Sandbox Code Playgroud)
错误是在count_help内调用count_help的行上的未绑定值count_help
该代码只是假设要计算给定字符x关联出现的次数