When trying to run the following function in OCaml
:
let rec func1 o_list =
match o_list with
| [] -> []
| h::t -> let (nt,inner_list) = h in
if check_if_clear inner_list then
[nt,inner_list]::clear_rules
func1 t
;;
the program outputs an error
Characters 139-141: [nt,inner_list]::clear_rules
Error: This variant expression is expected to have type unit The constructor :: does not belong to type unit
Also you can assume that the function check_if_clear
always returns true
for now.
o_list
is a list of pair and pair itself contains an element and a list.
So it is something like this [ 'x , ['a,'b,'c]]
and clear_rules
is just an empty list at first.