diff options
| author | herbelin | 2010-07-29 22:59:55 +0000 |
|---|---|---|
| committer | herbelin | 2010-07-29 22:59:55 +0000 |
| commit | 3dbc498b78a1b64a5d0edc4e1ec947a0bbc2cae0 (patch) | |
| tree | 8e76c87820bc45524e8f7ac40643ff7e7feb3118 /lib | |
| parent | 0824e2aaec90deea52d0a638e2a8a2da74f8fbb4 (diff) | |
Fixed a bug introduced (r13316/r13329) in the printing of notations
with non-recursive binders.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13357 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/util.ml | 10 | ||||
| -rw-r--r-- | lib/util.mli | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/util.ml b/lib/util.ml index 16e00a0899..7e62f77032 100644 --- a/lib/util.ml +++ b/lib/util.ml @@ -699,6 +699,16 @@ let list_split_when p = in split_when_loop [] +(* [list_split_by p l] splits [l] into two lists [(l1,l2)] such that elements of + [l1] satisfy [p] and elements of [l2] do not *) +let list_split_by p = + let rec split_by_loop = function + | [] -> ([],[]) + | a::l -> + let (l1,l2) = split_by_loop l in if p a then (a::l1,l2) else (l1,a::l2) + in + split_by_loop + let rec list_split3 = function | [] -> ([], [], []) | (x,y,z)::l -> diff --git a/lib/util.mli b/lib/util.mli index e77de4be9b..83fac5fcd1 100644 --- a/lib/util.mli +++ b/lib/util.mli @@ -181,6 +181,7 @@ val list_subset : 'a list -> 'a list -> bool val list_chop : int -> 'a list -> 'a list * 'a list (* former [list_split_at] was a duplicate of [list_chop] *) val list_split_when : ('a -> bool) -> 'a list -> 'a list * 'a list +val list_split_by : ('a -> bool) -> 'a list -> 'a list * 'a list val list_split3 : ('a * 'b * 'c) list -> 'a list * 'b list * 'c list val list_partition_by : ('a -> 'a -> bool) -> 'a list -> 'a list list val list_firstn : int -> 'a list -> 'a list |
