-type int_vector
-
-external int_vector_alloc : int -> int_vector = "caml_int_vector_alloc"
-external int_vector_set : int_vector -> int -> int -> unit = "caml_int_vector_set"
-external int_vector_length : int_vector -> int = "caml_int_vector_length"
-external int_vector_empty : unit -> int_vector = "caml_int_vector_empty"
-
-let empty_vector = int_vector_empty ()
-
-let to_int_vector_ext s =
- let l = cardinal s in
- let v = int_vector_alloc l in
- let i = ref 0 in
- iter (fun e -> int_vector_set v !i e; incr i) s;
- v
-
-let hash_vectors = Hashtbl.create 4097
-
-let to_int_vector s =
- try
- Hashtbl.find hash_vectors s.key
- with
- Not_found ->
- let v = to_int_vector_ext s in
- Hashtbl.add hash_vectors s.key v;
- v
-
-
+let rec uncons n = match HNode.node n with
+ | Empty -> raise Not_found
+ | Leaf k -> (k,empty)
+ | Branch (p,m,s,t) -> let h,ns = uncons s in h,branch_ne p m ns t
+
+let from_list l = List.fold_left (fun acc e -> add e acc) empty l
+
+
+end
+
+module Int : sig
+ include S with type elt = int
+ val print : Format.formatter -> t -> unit
+end
+ =
+struct
+ include Make ( struct type t = int
+ type data = t
+ external hash : t -> int = "%identity"
+ external uid : t -> int = "%identity"
+ let equal : t -> t -> bool = (==)
+ external make : t -> int = "%identity"
+ external node : t -> int = "%identity"
+
+ end
+ )
+ let print ppf s =
+ Format.pp_print_string ppf "{ ";
+ iter (fun i -> Format.fprintf ppf "%i " i) s;
+ Format.pp_print_string ppf "}";
+ Format.pp_print_flush ppf ()
+ end