aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2007-04-28 13:56:03 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2007-04-28 13:56:03 +0000
commit27ea35bafdf0aefe1dcf49dfed1a18c3f158efa5 (patch)
tree36e033096a8f42fe4e2d2ff15647799e6495bfa9 /lib
parentef486799ac73c533e0a5b5cdd2662eb68a2636cb (diff)
Ajout de la possibilité de faire référence dans certains cas à un nom
par sa notation (p.ex. pour unfold ou pour lazy delta). Ex: Goal 3+4 = 7. unfold "+". git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@9804 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
-rw-r--r--lib/util.ml5
-rw-r--r--lib/util.mli1
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/util.ml b/lib/util.ml
index ee373120e..8b3fb2428 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -778,6 +778,11 @@ let option_smartmap f a = match a with
| None -> a
| Some x -> let x' = f x in if x'==x then a else Some x'
+let rec filter_some = function
+ | [] -> []
+ | None::l -> filter_some l
+ | Some a::l -> a :: filter_some l
+
let map_succeed f =
let rec map_f = function
| [] -> []
diff --git a/lib/util.mli b/lib/util.mli
index afa11d31d..8a406519e 100644
--- a/lib/util.mli
+++ b/lib/util.mli
@@ -216,6 +216,7 @@ val option_fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b option ->
val option_iter : ('a -> unit) -> 'a option -> unit
val option_compare : ('a -> 'b -> bool) -> 'a option -> 'b option -> bool
val option_smartmap : ('a -> 'a) -> 'a option -> 'a option
+val filter_some : 'a option list -> 'a list
(* In [map_succeed f l] an element [a] is removed if [f a] raises *)
(* [Failure _] otherwise behaves as [List.map f l] *)