需要帮助检查天气列表在 ocaml 中排序
这行得通吗?
let issorted x = match x with
[] -> true
| _::[] -> true
| _::_ -> issorted_helper (x)
;;
let rec issorted_helper x = match x with
| [] -> true
| h::t ->
if h > t
false
else
issorted_helper(t)
;;