*)
(*
- * implementazione del comando DIFF
- *)
+ * vecchia implementazione del comando DIFF
+
exception NotCompatible;;
| _, _ -> raise NotCompatible (* same keys, different values *)
;;
-(*
- * implementazione del comando DIFF
- *)
+
let rec diff_ex l1 l2 =
let module S = Mathql_semantics in
match (l1, l2) with
NotCompatible ->
{S.uri = uri1 ; S.attributes = attributes1 ; S.extra = ""}::(diff_ex tl1 tl2)
;;
+*)
+
+(*
+ * implementazione del comando DIFF
+ *)
+let rec diff_ex rs1 rs2 =
+ match (rs1, rs2) with
+ [],_ -> []
+ | l,[] -> l
+ | (uri1,l)::tl1,(uri2,_)::_ when uri1 < uri2 -> (uri1,l)::(diff_ex tl1 rs2)
+ | (uri1,_)::_,(uri2,_)::tl2 when uri2 < uri1 -> (diff_ex rs1 tl2)
+ | (uri1,_)::tl1, (uri2,_)::tl2 -> (diff_ex tl1 tl2)
+;;
+
+
+(*
let diff_ex l1 l2 =
- let before = Unix.time () in
+ let before = Sys.time () in
let res = diff_ex l1 l2 in
- let after = Unix.time () in
+ let after = Sys.time () in
let ll1 = string_of_int (List.length l1) in
let ll2 = string_of_int (List.length l2) in
let diff = string_of_float (after -. before) in
prerr_endline
("DIFF(" ^ ll1 ^ ", " ^ ll2 ^ ") = " ^ string_of_int (List.length res) ^
": " ^ diff ^ "s") ;
- flush stderr ;
+ flush stdout ;
res
;;
-
+*)