0
我无法从书籍Real World OCaml运行一些代码。代码片段位于github。具体地讲,我得到一个类型的错误在第6行:OCaml Core List.Assoc.find
List.Assoc.find counts line
我使用OCaml的4.04.1和根据UTOP,的List.Assoc.find
类型签名是:
('a, 'b) List.Assoc.t -> equal:('a -> 'a -> bool) -> 'a -> 'b option = <fun
注意上面代码片段中缺少的非可选参数equal
。但是,根据最新(截至2017年6月)documentation对于List.Assoc.find
,equal
参数是可选的。
equal
参数的用途是什么?
此代码的工作对我来说: '让ASSOC = [( “一”,1); ( “二”,2); (“three”,3)] ;;' 'List.Assoc.find assoc“two”〜equal:(=);;' –