aboutsummaryrefslogtreecommitdiff
path: root/lib/util.ml
diff options
context:
space:
mode:
authorfilliatr1999-08-26 09:59:16 +0000
committerfilliatr1999-08-26 09:59:16 +0000
commitd0ad74b61a525ef09ed208fbe15060ea92897fb4 (patch)
treea9ec9b838adf3cf9f8c498e5111de0bfa39d2199 /lib/util.ml
parentd410804226ddeb15ab05af5298502ef29efbd0d8 (diff)
module Coqast
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@25 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib/util.ml')
-rw-r--r--lib/util.ml14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 3bac54cf94..95a609378f 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -63,12 +63,22 @@ let parse_section_path s =
(* Lists *)
-let intersect l1 l2 =
+let list_intersect l1 l2 =
List.filter (fun x -> List.mem x l2) l1
-let subtract l1 l2 =
+let list_unionq l1 l2 =
+ let rec urec = function
+ | [] -> l2
+ | a::l -> if List.memq a l2 then urec l else a::urec l
+ in
+ urec l1
+
+let list_subtract l1 l2 =
if l2 = [] then l1 else List.filter (fun x -> not (List.mem x l2)) l1
+let list_subtractq l1 l2 =
+ if l2 = [] then l1 else List.filter (fun x -> not (List.memq x l2)) l1
+
let list_chop n l =
let rec chop_aux acc = function
| (0, l2) -> (List.rev acc, l2)