aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorvgross2009-03-02 15:29:08 +0000
committervgross2009-03-02 15:29:08 +0000
commit95dcebe76caf6a93289e484995760ec94111c7c8 (patch)
tree4f0e147cc5a7b3a66b7371442b46e6ed35a51853 /lib
parent066a564021788e995eb166ad6ed6e55611d6f593 (diff)
Heavy modifications on the widget and edition tab creation mechanism.
Overloading of GPack.notebook => Vector no longer needed git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@11952 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
-rw-r--r--lib/util.ml7
-rw-r--r--lib/util.mli2
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 57fea38084..a7d2099f1f 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -687,6 +687,13 @@ let list_map_i f =
in
map_i_rec
+let list_filter_i p =
+ let rec filter_i_rec i = function
+ | [] -> []
+ | x::l -> let l' = filter_i_rec (succ i) l in if p i x then x::l' else l'
+ in
+ filter_i_rec 0
+
let rec list_sep_last = function
| [] -> failwith "sep_last"
| hd::[] -> (hd,[])
diff --git a/lib/util.mli b/lib/util.mli
index 1be7f807a2..34e91215ad 100644
--- a/lib/util.mli
+++ b/lib/util.mli
@@ -124,6 +124,8 @@ val list_map3 :
('a -> 'b -> 'c -> 'd) -> 'a list -> 'b list -> 'c list -> 'd list
val list_map4 :
('a -> 'b -> 'c -> 'd -> 'e) -> 'a list -> 'b list -> 'c list -> 'd list -> 'e list
+val list_filter_i :
+ (int -> 'a -> bool) -> 'a list -> 'a list
(* [list_index] returns the 1st index of an element in a list (counting from 1) *)
val list_index : 'a -> 'a list -> int
(* [list_unique_index x l] returns [Not_found] if [x] doesn't occur exactly once *)