aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorletouzey2013-10-23 22:17:11 +0000
committerletouzey2013-10-23 22:17:11 +0000
commitef42739eadeb6ec3fc98b5beaa13bd859de44d15 (patch)
treed0db75605b1ff04fe13f70f0a02aacbee7465cf0 /lib
parent5e6145c871eea1e94566b252b4bfc4cd752f42d5 (diff)
cList.index is now cList.index_f, same for index0
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16921 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
-rw-r--r--lib/cList.ml14
-rw-r--r--lib/cList.mli8
2 files changed, 6 insertions, 16 deletions
diff --git a/lib/cList.ml b/lib/cList.ml
index 904f3ee63f..a6d157291c 100644
--- a/lib/cList.ml
+++ b/lib/cList.ml
@@ -90,10 +90,8 @@ sig
val filteri :
(int -> 'a -> bool) -> 'a list -> 'a list
val smartfilter : ('a -> bool) -> 'a list -> 'a list
- val index : 'a -> 'a list -> int
- val index_f : ('a -> 'a -> bool) -> 'a -> 'a list -> int
- val index0 : 'a -> 'a list -> int
- val index0_f : ('a -> 'a -> bool) -> 'a -> 'a list -> int
+ val index : 'a eq -> 'a -> 'a list -> int
+ val index0 : 'a eq -> 'a -> 'a list -> int
val iteri : (int -> 'a -> unit) -> 'a list -> unit
val fold_left_until : ('c -> 'a -> 'c CSig.until) -> 'c -> 'a list -> 'c
val fold_right_i : (int -> 'a -> 'b -> 'b) -> int -> 'a list -> 'b -> 'b
@@ -406,18 +404,14 @@ let rec smartfilter f l = match l with
else h :: tl'
else tl'
-let index_f f x =
+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 index0_f f x l = index_f f x l - 1
-
-let index x l = index_f Pervasives.(=) x l (* FIXME : prefer [index_f]*)
-
-let index0 x l = index x l - 1 (* FIXME *)
+let index0 f x l = index f x l - 1
let fold_left_until f accu s =
let rec aux accu = function
diff --git a/lib/cList.mli b/lib/cList.mli
index ee6595632c..aec326c514 100644
--- a/lib/cList.mli
+++ b/lib/cList.mli
@@ -137,16 +137,12 @@ sig
(** [smartfilter f [a1...an] = List.filter f [a1...an]] but if for all i
[f ai = true], then [smartfilter f l == l] *)
- val index : 'a -> 'a list -> int
+ val index : 'a eq -> 'a -> 'a list -> int
(** [index] returns the 1st index of an element in a list (counting from 1). *)
- val index_f : 'a eq -> 'a -> 'a list -> int
-
- val index0 : 'a -> 'a list -> int
+ val index0 : 'a eq -> 'a -> 'a list -> int
(** [index0] behaves as [index] except that it starts counting at 0. *)
- val index0_f : 'a eq -> 'a -> 'a list -> int
-
val iteri : (int -> 'a -> unit) -> 'a list -> unit
(** As [iter] but with the index argument (starting from 0). *)