-1
val compare : bool array array -> 'a list -> 'a list -> int
比较m在列表中生成字典顺序。我不知道怎么填???
比较两个等价类(续)
let rec compare m c c' =
match c with
| [] -> (match c' with
| [] -> 0
| _ :: _ -> -1)
| hd1 :: tl1 -> (match c' with
| [] -> 1
| hd2 :: tl2 -> ???
这是我尝试在INTS的名单做一个功能。但是这个函数并不满足,它仍然缺少检查列表的其余部分。
let cmp_classes m c c' =
match c, c' with
| i :: _, j :: _ ->
begin
match m.(i).(j), m.(j).(i) with
(* same class: there is a path between i and j, and between j and i *)
| true, true -> 0
(* there is a path between i and j *)
| true, false -> 1
(* there is a path between j and i *)
| false, true -> -1
(* i and j are not compareable *)
| false, false -> 0
end
| _ -> assert false
你能帮我吗?因为当我尝试使用此功能在int
let cmp_classes m i j =
match m.(i).(j), m.(j).(i) with
(* same class: there is a path between i and j, and between j and i *)
| true, true -> 0
(* there is a path between i and j *)
| true, false -> 1
(* there is a path between j and i *)
| false, true -> -1
(* i and j are not compareable *)
| false, false -> 0
它仍然没有返回数据我测试正确的顺序。 我一直在做这个功能很多次,当我不得不一次又一次地尝试,但没有发现什么是错误的时候,它真的被卡住了。拜托我需要你的帮忙。谢谢