diff options
| author | msozeau | 2011-02-14 09:15:15 +0000 |
|---|---|---|
| committer | msozeau | 2011-02-14 09:15:15 +0000 |
| commit | e4c7ad09b0be022a59760d78cc382687294c9350 (patch) | |
| tree | b14654a6c6106a9f27b388e0cd65509a7c77a82c /lib | |
| parent | 77b0b252f3ce600e1c70e613af878e74439a585b (diff) | |
- Fix treatment of globality flag for typeclass instance hints (they
were all declared as global).
- Add possibility to remove hints (Resolve or Immediate only) based on
the name of the lemma.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13842 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/util.ml | 9 | ||||
| -rw-r--r-- | lib/util.mli | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/util.ml b/lib/util.ml index fb271ea421..a8e716e0f3 100644 --- a/lib/util.ml +++ b/lib/util.ml @@ -488,6 +488,15 @@ let list_map4 f l1 l2 l3 l4 = in map (l1,l2,l3,l4) +let rec list_smartfilter f l = match l with + [] -> l + | h::tl -> + let tl' = list_smartfilter f tl in + if f h then + if tl' == tl then l + else h :: tl' + else tl' + let list_index x = let rec index_x n = function | y::l -> if x = y then n else index_x (succ n) l diff --git a/lib/util.mli b/lib/util.mli index 13be5521d6..5248d0e6b1 100644 --- a/lib/util.mli +++ b/lib/util.mli @@ -149,6 +149,10 @@ val list_map4 : val list_filter_i : (int -> 'a -> bool) -> 'a list -> 'a list +(** [list_smartfilter f [a1...an] = List.filter f [a1...an]] but if for all i + [f ai = true], then [list_smartfilter f l==l] *) +val list_smartfilter : ('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 |
