Safety commit before clean-up
[SXSI/xpathcomp.git] / hlist.ml
index e5a4aa5..0e50d61 100644 (file)
--- a/hlist.ml
+++ b/hlist.ml
@@ -13,7 +13,7 @@ module type S = sig
   type data = Data.t
   type t = Node.t
   val hash : t -> int
-  val uid : t -> int
+  val uid : t -> Uid.t
   val make : data -> t
   val equal : t -> t -> bool
   val nil : t
@@ -27,6 +27,8 @@ module type S = sig
   val rev : t -> t
   val rev_map : (elt -> elt) -> t -> t
   val length : t -> int
+
+  val with_id : Uid.t -> t
 end
 
 module Make ( H : Hcons.SA ) : S with type elt = H.t =
@@ -44,15 +46,15 @@ struct
        | _ -> false
     let hash = function 
       | Nil -> 0
-      | Cons(a,aa) -> HASHINT3(PRIME3,H.uid a, aa.Node.id)
+      | Cons(a,aa) -> HASHINT3(PRIME3,Uid.to_int (H.uid a),Uid.to_int( aa.Node.id))
   end
   type data = Data.t
   type t = Node.t
   let make = Node.make
-  let node Node.node
-  let hash = Node.hash 
+  let node x = x.Node.node
+  let hash x = x.Node.key
   let equal = Node.equal
-  let uid = Node.uid
+  let uid x= x.Node.id
   let nil = Node.make Nil
   let cons a b = Node.make (Cons(a,b))
   let hd = function { Node.node = Cons(a,_) } -> a | _ -> failwith "hd"
@@ -82,4 +84,7 @@ struct
   let rev l = fold cons l nil
   let rev_map f l = fold (fun x acc -> cons (f x) acc) l nil
   let length l = fold (fun _ c -> c+1) l 0 
+    
+
+  let with_id = Node.with_id
 end