diff options
author | herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2007-04-28 13:56:03 +0000 |
---|---|---|
committer | herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2007-04-28 13:56:03 +0000 |
commit | 27ea35bafdf0aefe1dcf49dfed1a18c3f158efa5 (patch) | |
tree | 36e033096a8f42fe4e2d2ff15647799e6495bfa9 /lib | |
parent | ef486799ac73c533e0a5b5cdd2662eb68a2636cb (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.ml | 5 | ||||
-rw-r--r-- | lib/util.mli | 1 |
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] *) |