This function is supposed to put the equivalence classes in separate lists.
Ex) blah (=) [1;2;3;4;5;1;2;3;4;5;1;2;3;4;7] -> [[1;1;1];[2;2;2];[3;3;3];[4;4;4];[5;5];[7]]
let blah equiv lst =
let rec update_lst func_u lst_u h_u =
match lst_u with
[] -> []
| h::t -> if (func_u h = func_u h_u) then update_lst func_u t h_u
else [h]@(update_lst func_u t h_u)
in
let rec blah_2 func_2 lst_2 =
match lst_2 with
[] -> []
| h::t -> [blah_3 func_2 lst_2 h]@[blah_2 func_2 (update_lst func_2 lst_2 h)]
and blah_3 func_3 lst_3 head =
match lst_3 with
[] -> []
| h::t -> if (func_3 h = func_3 head) then [h]@(blah_3 func_3 lst_3 t)
else blah_3 func_c lst_3 t
in
blah_2 equiv lst;
It gives me the following error:
Line 9, characters 2-110:
This expression has type ‘a list but is here used with type ‘a
It is referring to:
match lst_2 with
Can someone help me!? Thanks in advance.
This entry was posted in Codes & Scripts and tagged Compile, Function, not>. Bookmark the permalink.