aboutsummaryrefslogtreecommitdiff
path: root/lib/cList.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2013-11-23 18:58:02 +0100
committerPierre-Marie Pédrot2013-11-24 00:04:10 +0100
commita000b714412e4b1f48bf3ffe1479cf6589874b47 (patch)
tree5c15ee942d26ff785fc993ac3192170406d1ea02 /lib/cList.ml
parentc022a4a8faa9c8c7deb28744c779847d621d2b0c (diff)
Tweaking arity & allocation of some basic functions.
Diffstat (limited to 'lib/cList.ml')
-rw-r--r--lib/cList.ml13
1 files changed, 6 insertions, 7 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