列出我有一个返回(字符列表)列表选项,而且我试图获取列表的大小的功能:列表选项OCaml中
let c = recherche m ledico in
match c with
| None -> Printf.printf "Non."
| Some [] -> Printf.printf "Oui."
| _ ->
let n = List.length c in
(...)
recherche
是返回我的功能(char list) list option
,它可以返回None
,Some []
或Some [[...] ; ... ; [...]]
。我如何找到这个长度?我看到this解决方案,但它没有工作:
Error: The function applied to this argument has type 'a list -> 'a list
This argument cannot be applied with label ~f
我如何获得一个列表选项的大小?
Oooohhh ... duh。 –