* http://cs.unibo.it/helm/.
*)
-(*
- *)
+(* AUTOR: Ferruccio Guidi <fguidi@cs.unibo.it>
+ *)
(* text linearization and parsing *******************************************)
| M.Or -> out " or "
| M.And -> out " and "
| M.Sub -> out " sub "
- | M.Meet -> out " eq "
+ | M.Meet -> out " meet "
| M.Eq -> out " eq "
| M.Le -> out " le "
| M.Lt -> out " lt "
| M.StatQuery x -> out "stat "; txt_set x
| M.Keep b l x -> out "keep "; txt_allbut b; txt_path_list l;
txt_set x
-
in
txt_set x; out sep
let u1 = Unix.time () in
Printf.sprintf "%.2fs,%.2fs" (s1 -. s0) (u1 -. u0)
+(* operations on lists *****************************************************)
+
+type 'a comparison = Lt
+ | Gt
+ | Eq of 'a
+
+let list_join f l1 l2 =
+ let rec aux = function
+ | [], v
+ | v, [] -> v
+ | ((h1 :: t1) as v1), ((h2 :: t2) as v2) -> begin
+ match f h1 h2 with
+ | Lt -> h1 :: aux (t1, v2)
+ | Gt -> h2 :: aux (v1, t2)
+ | Eq h -> h :: aux (t1, t2)
+ end
+ in aux (l1, l2)
+
+let list_meet f l1 l2 =
+ let rec aux = function
+ | [], v
+ | v, [] -> []
+ | ((h1 :: t1) as v1), ((h2 :: t2) as v2) -> begin
+ match f h1 h2 with
+ | Lt -> aux (t1, v2)
+ | Gt -> aux (v1, t2)
+ | Eq h -> h :: aux (t1, t2)
+ end
+ in aux (l1, l2)
+
(* conversion functions *****************************************************)
type uriref = UriManager.uri * (int list)