列出我有一個返回(字符列表)列表選項,而且我試圖獲取列表的大小的功能:列表選項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。 –