Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ocaml 匹配“Some and None”的模式与float-in-float选项不匹配?_Ocaml_Typeerror - Fatal编程技术网

Ocaml 匹配“Some and None”的模式与float-in-float选项不匹配?

Ocaml 匹配“Some and None”的模式与float-in-float选项不匹配?,ocaml,typeerror,Ocaml,Typeerror,我正在尝试匹配从List.Assoc.find float选项返回的浮点值 我正在使用模式匹配,但它似乎不起作用 let evalVar (_x: string) (_q:envQueue): float = match List.Assoc.find _q _x with Some(s) -> s | None -> 0.0 我得到这个错误: Error: This pattern matches values of type 'a o

我正在尝试匹配从List.Assoc.find float选项返回的浮点值

我正在使用模式匹配,但它似乎不起作用

let evalVar (_x: string) (_q:envQueue): float  = 
    match List.Assoc.find _q _x with
        Some(s) -> s
        | None -> 0.0
我得到这个错误:

Error: This pattern matches values of type 'a option
       but a pattern was expected which matches values of type
         equal:(string -> string -> bool) -> float option
List.Assoc.find的签名为:


请注意:在标识符前面加下划线会抑制有关未使用名称的警告。它不应该用于那些没有被使用过的名字,因为警告和这个意符是有意的,失去了它的目的。
utop # List.Assoc.find;;
- : ('a, 'b) List.Assoc.t -> equal:('a -> 'a -> bool) -> 'a -> 'b option =
<fun>
utop # List.Assoc.find [("a",1);("b",2)] ~equal:(fun  _a _b -> _a=_b) "a";;
- : int option = Some 1