diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/cList.ml | 13 | ||||
| -rw-r--r-- | lib/hashcons.ml | 4 | ||||
| -rw-r--r-- | lib/hashset.ml | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/lib/cList.ml b/lib/cList.ml index 02e46092c3..1a1993cd6f 100644 --- a/lib/cList.ml +++ b/lib/cList.ml @@ -417,14 +417,13 @@ let rec smartfilter f l = match l with else h :: tl' else tl' -let index f x = - let rec index_x n = function - | y::l -> if f x y then n else index_x (succ n) l - | [] -> raise Not_found - in - index_x 1 +let rec index_f f x l n = match l with +| [] -> raise Not_found +| y :: l -> if f x y then n else index_f f x l (succ n) + +let index f x l = index_f f x l 1 -let index0 f x l = index f x l - 1 +let index0 f x l = index_f f x l 0 let fold_left_until f accu s = let rec aux accu = function diff --git a/lib/hashcons.ml b/lib/hashcons.ml index 3a8a86e3ee..72381ae2bd 100644 --- a/lib/hashcons.ml +++ b/lib/hashcons.ml @@ -79,7 +79,9 @@ module Make (X : HashconsedType) = * sub-hcons functions. *) (* For non-recursive types it is quite easy. *) -let simple_hcons h u = h () u +let simple_hcons h u = + let h = h () in + fun x -> h u x (* For a recursive type T, we write the module of sig Comp with u equals * to (T -> T) * u0 diff --git a/lib/hashset.ml b/lib/hashset.ml index 279beb1c99..8c40e55001 100644 --- a/lib/hashset.ml +++ b/lib/hashset.ml @@ -73,7 +73,9 @@ module Make (E : EqType) = | true -> f b t.hashes.(j) i; iter_bucket (i+1) j b | false -> iter_bucket (i+1) j b in - Array.iteri (iter_bucket 0) t.table + for i = 0 to pred (Array.length t.table) do + iter_bucket 0 i (Array.unsafe_get t.table i) + done let rec count_bucket i b accu = if i >= Weak.length b then accu else |
