X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=hlist.ml;h=0e50d617f8b4b44ad33e1be88c141a10def72214;hb=bf2b1a91300ace1e7e83bd78f868a269d86498f9;hp=5509871306deec04bd9e1267dcc5bb3e4cc3b156;hpb=83b4813de7204842bb59d5cb0aec71aff633ca85;p=SXSI%2Fxpathcomp.git diff --git a/hlist.ml b/hlist.ml index 5509871..0e50d61 100644 --- 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,7 +46,7 @@ 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 @@ -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