Fix CCTrie.Make: Remove polymorphic comparison

This commit is contained in:
Jacques-Pascal Deplaix 2017-11-07 12:11:41 +01:00
parent f28b75792b
commit 0ed3c70669

View file

@ -593,6 +593,13 @@ module Make(W : WORD)
in in
List.iter (explore ~dir k) l' List.iter (explore ~dir k) l'
let _list_eq l1 l2 =
try List.for_all2 (fun x y -> W.compare x y = 0) l1 l2
with Invalid_argument _ -> false
let _key_to_list key =
List.rev (_seq_append_list_rev [] (W.to_seq key))
(* range above (if [above = true]) or below a threshold . (* range above (if [above = true]) or below a threshold .
[p c c'] must return [true] if [c'], in the tree, meets some criterion [p c c'] must return [true] if [c'], in the tree, meets some criterion
w.r.t [c] which is a part of the key. *) w.r.t [c] which is a part of the key. *)
@ -646,7 +653,7 @@ module Make(W : WORD)
_iter_prefix ~prefix (fun key' v -> k (key', v)) t _iter_prefix ~prefix (fun key' v -> k (key', v)) t
| Some (Node (Some v, _), prefix), Below -> | Some (Node (Some v, _), prefix), Below ->
(* yield the value for key *) (* yield the value for key *)
assert (W.of_list (prefix []) = key); assert (_list_eq (prefix []) (_key_to_list key));
k (key, v) k (key, v)
| Some _, _ | Some _, _
| None, _ -> () | None, _ -> ()